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 }

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 }

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

pwiz::msdata::ChromatogramIdentity::id
std::string id
a unique identifier for this chromatogram. It should be expected that external files may use this ide...
Definition: MSData.hpp:495
pwiz::msdata::ChromatogramListSimple
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:790
MyWrapper
Definition: ChromatogramListWrapperTest.cpp:34
test
void test()
Definition: ChromatogramListWrapperTest.cpp:50
pwiz::msdata::ChromatogramIdentity
Identifying information for a chromatogram.
Definition: MSData.hpp:489
pwiz::msdata::Chromatogram
A single chromatogram.
Definition: MSData.hpp:577
TEST_EPILOG
#define TEST_EPILOG
Definition: unit.hpp:183
TEST_FAILED
#define TEST_FAILED(x)
Definition: unit.hpp:177
TEST_PROLOG
#define TEST_PROLOG(argc, argv)
Definition: unit.hpp:175
pwiz::msdata::ChromatogramPtr
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:624
unit_assert
#define unit_assert(x)
Definition: unit.hpp:85
pwiz::msdata::ChromatogramIdentity::index
size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
Definition: MSData.hpp:492
pwiz::msdata::ChromatogramListSimplePtr
boost::shared_ptr< ChromatogramListSimple > ChromatogramListSimplePtr
Definition: MSData.hpp:805