ProteoWizard
Classes | Functions
ChromatogramListWrapperTest.cpp File Reference
#include "ChromatogramListWrapper.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "pwiz/utility/misc/Std.hpp"

Go to the source code of this file.

Classes

class  MyWrapper
 

Functions

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

Function Documentation

◆ test()

void test ( )

Definition at line 50 of file ChromatogramListWrapperTest.cpp.

51{
53
54 const size_t chromatogramCount = 10;
55 for (size_t i=0; i<chromatogramCount; i++)
56 {
57 simple->chromatograms.push_back(ChromatogramPtr(new Chromatogram));
58 Chromatogram& s = *simple->chromatograms.back();
59 s.index = i;
60 s.id = "S" + lexical_cast<string>(i);
61 s.nativeID = lexical_cast<string>(i);
62 }
63
64 shared_ptr<MyWrapper> wrapper(new MyWrapper(simple));
65
66 // make sure we're getting what we expect
67
68 wrapper->verifySize(10);
69 unit_assert(wrapper->size() == 10);
70 for (size_t i=0; i<chromatogramCount; i++)
71 {
72 string id = "S" + lexical_cast<string>(i);
73 string nativeID = lexical_cast<string>(i);
74
75 unit_assert(wrapper->find(id) == i);
76 unit_assert(wrapper->findNative(nativeID) == i);
77
78 const ChromatogramIdentity& identity = wrapper->chromatogramIdentity(i);
79 unit_assert(identity.id == id);
80 unit_assert(identity.nativeID == nativeID);
81
82 ChromatogramPtr s = wrapper->chromatogram(i);
83 unit_assert(s->id == id);
84 unit_assert(s->nativeID == nativeID);
85 }
86}
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition MSData.hpp:624
boost::shared_ptr< ChromatogramListSimple > ChromatogramListSimplePtr
Definition MSData.hpp:805
A single chromatogram.
Definition MSData.hpp:578
Identifying information for a chromatogram.
Definition MSData.hpp:490
std::string id
a unique identifier for this chromatogram. It should be expected that external files may use this ide...
Definition MSData.hpp:495
size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
Definition MSData.hpp:492
Simple writeable in-memory implementation of ChromatogramList.
Definition MSData.hpp:791
#define unit_assert(x)
Definition unit.hpp:85

References pwiz::msdata::ChromatogramIdentity::id, pwiz::msdata::ChromatogramIdentity::index, and unit_assert.

Referenced by main().

◆ main()

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

Definition at line 89 of file ChromatogramListWrapperTest.cpp.

90{
91 TEST_PROLOG(argc, argv)
92
93 try
94 {
95 test();
96 }
97 catch (exception& e)
98 {
99 TEST_FAILED(e.what())
100 }
101 catch (...)
102 {
103 TEST_FAILED("Caught unknown exception.")
104 }
105
107}
#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 test(), TEST_EPILOG, TEST_FAILED, and TEST_PROLOG.