ProteoWizard
Functions | Variables
ProteinListFactoryTest.cpp File Reference
#include "ProteinListFactory.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "pwiz/utility/misc/Std.hpp"
#include "pwiz/data/proteome/examples.hpp"
#include <cstring>

Go to the source code of this file.

Functions

void testUsage ()
 
void testWrap ()
 
void test ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_ = 0
 

Function Documentation

§ testUsage()

void testUsage ( )

Definition at line 38 of file ProteinListFactoryTest.cpp.

References os_, and pwiz::analysis::ProteinListFactory::usage().

Referenced by test().

39 {
40  if (os_) *os_ << "ProteinListFactory::usage():\n" << ProteinListFactory::usage() << endl;
41 }
ostream * os_

§ testWrap()

void testWrap ( )

Definition at line 44 of file ProteinListFactoryTest.cpp.

References pwiz::identdata::examples::initializeTiny(), pwiz::proteome::ProteomeData::proteinListPtr, unit_assert, unit_assert_operator_equal, and pwiz::analysis::ProteinListFactory::wrap().

Referenced by test().

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 }
#define unit_assert_operator_equal(expected, actual)
Definition: unit.hpp:92
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
boost::shared_ptr< ProteinList > ProteinListPtr
#define unit_assert(x)
Definition: unit.hpp:85

§ test()

void test ( )

Definition at line 65 of file ProteinListFactoryTest.cpp.

References testUsage(), and testWrap().

Referenced by main().

66 {
67  testUsage();
68  testWrap();
69 }
void testUsage()
void testWrap()

§ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 72 of file ProteinListFactoryTest.cpp.

References os_, test(), TEST_EPILOG, TEST_FAILED, and TEST_PROLOG.

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 }
#define TEST_EPILOG
Definition: unit.hpp:182
void test()
ostream * os_
#define TEST_FAILED(x)
Definition: unit.hpp:176
#define TEST_PROLOG(argc, argv)
Definition: unit.hpp:174

Variable Documentation

§ os_

ostream* os_ = 0

Definition at line 35 of file ProteinListFactoryTest.cpp.

Referenced by main(), and testUsage().