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.

39{
40 if (os_) *os_ << "ProteinListFactory::usage():\n" << ProteinListFactory::usage() << endl;
41}
ostream * os_
static std::string usage()
user-friendly documentation

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

Referenced by test().

◆ testWrap()

void testWrap ( )

Definition at line 44 of file ProteinListFactoryTest.cpp.

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}
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 unit_assert_operator_equal(expected, actual)
Definition unit.hpp:92

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

Referenced by test().

◆ test()

void test ( )

Definition at line 65 of file ProteinListFactoryTest.cpp.

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

References testUsage(), and testWrap().

Referenced by main().

◆ main()

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

Definition at line 72 of file ProteinListFactoryTest.cpp.

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}
void test()
#define TEST_EPILOG
Definition unit.hpp:183
#define TEST_FAILED(x)
Definition unit.hpp:177
#define TEST_PROLOG(argc, argv)
Definition unit.hpp:175

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

Variable Documentation

◆ os_

ostream* os_ = 0

Definition at line 35 of file ProteinListFactoryTest.cpp.

Referenced by main(), and testUsage().