ProteoWizard
ProteinListFactoryTest.cpp
Go to the documentation of this file.
1//
2// $Id$
3//
4//
5// Original author: Matt Chambers <matt.chambers <a.t> vanderbilt.edu>
6//
7// Copyright 2012 Vanderbilt University - Nashville, TN 37232
8//
9// Licensed under the Apache License, Version 2.0 (the "License");
10// you may not use this file except in compliance with the License.
11// You may obtain a copy of the License at
12//
13// http://www.apache.org/licenses/LICENSE-2.0
14//
15// Unless required by applicable law or agreed to in writing, software
16// distributed under the License is distributed on an "AS IS" BASIS,
17// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18// See the License for the specific language governing permissions and
19// limitations under the License.
20//
21
22
27#include <cstring>
28
29
30using namespace pwiz::analysis;
31using namespace pwiz::util;
32using namespace pwiz::proteome;
33
34
35ostream* os_ = 0;
36
37
39{
40 if (os_) *os_ << "ProteinListFactory::usage():\n" << ProteinListFactory::usage() << endl;
41}
42
43
45{
46 ProteomeData pd;
48
50
51 unit_assert(pl.get());
52 unit_assert_operator_equal(3, pl->size());
53
54 ProteinListFactory::wrap(pd, "id DEFCON42;ZEBRA");
55 unit_assert_operator_equal(2, pl->size());
56 unit_assert_operator_equal("ZEBRA", pl->protein(0)->id);
57 unit_assert_operator_equal("DEFCON42", pl->protein(1)->id);
58
59 ProteinListFactory::wrap(pd, "index 1");
60 unit_assert_operator_equal(1, pl->size());
61 unit_assert_operator_equal("DEFCON42", pl->protein(0)->id);
62}
63
64
65void test()
66{
67 testUsage();
68 testWrap();
69}
70
71
72int main(int argc, char* argv[])
73{
74 TEST_PROLOG(argc, argv)
75
76 try
77 {
78 if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
79 test();
80 }
81 catch (exception& e)
82 {
83 TEST_FAILED(e.what())
84 }
85 catch (...)
86 {
87 TEST_FAILED("Caught unknown exception.")
88 }
89
91}
92
int main(int argc, char *argv[])
void testWrap()
ostream * os_
void test()
void testUsage()
static std::string usage()
user-friendly documentation
static void wrap(proteome::ProteomeData &pd, const std::string &wrapper)
instantiate the ProteinListWrapper indicated by wrapper
PWIZ_API_DECL void initializeTiny(MSData &msd)
boost::shared_ptr< ProteinList > ProteinListPtr
#define unit_assert(x)
Definition unit.hpp:85
#define TEST_EPILOG
Definition unit.hpp:183
#define TEST_FAILED(x)
Definition unit.hpp:177
#define unit_assert_operator_equal(expected, actual)
Definition unit.hpp:92
#define TEST_PROLOG(argc, argv)
Definition unit.hpp:175