ProteoWizard
Classes | Functions
Reader_ABI_Test.cpp File Reference
#include "pwiz/utility/misc/unit.hpp"
#include "Reader_ABI.hpp"
#include "pwiz/utility/misc/VendorReaderTestHarness.hpp"
#include "pwiz/utility/misc/Filesystem.hpp"
#include "pwiz/utility/misc/Std.hpp"

Go to the source code of this file.

Classes

struct  IsWiffFile
 

Functions

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

Function Documentation

◆ main()

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

Definition at line 45 of file Reader_ABI_Test.cpp.

46 {
47  TEST_PROLOG(argc, argv)
48 
49  #ifdef PWIZ_READER_ABI
50  const bool testAcceptOnly = false;
51  #else
52  const bool testAcceptOnly = true;
53  #endif
54 
55  try
56  {
57  #ifdef PWIZ_READER_ABI
58 
59  using namespace pwiz::msdata;
60  using namespace pwiz::msdata::detail;
61  using namespace pwiz::msdata::detail::ABI;
62  using namespace pwiz::util;
63 
64  // test that all instrument types are handled by translation functions (skipping the 'Unknown' type)
65  bool allInstrumentTestsPassed = true;
66  for (int i = 1; i < (int) InstrumentModel_Count; ++i)
67  {
68  InstrumentModel model = (InstrumentModel) i;
69 
70  try
71  {
73 
74  InstrumentConfigurationPtr configuration = translateAsInstrumentConfiguration(model, IonSourceType_Unknown);
75 
76  unit_assert(configuration->componentList.source(0).hasCVParam(MS_ionization_type));
77  unit_assert(configuration->componentList.analyzer(0).hasCVParam(MS_quadrupole));
78  unit_assert(configuration->componentList.detector(0).hasCVParam(MS_electron_multiplier));
79  }
80  catch (runtime_error& e)
81  {
82  cerr << "Unit test failed for instrument model " << lexical_cast<string>(model) << ":\n" << e.what() << endl;
83  allInstrumentTestsPassed = false;
84  }
85  }
86 
87  unit_assert(allInstrumentTestsPassed);
88  #endif
89 
90  bool requireUnicodeSupport = true;
91  pwiz::util::testReader(pwiz::msdata::Reader_ABI(), testArgs, testAcceptOnly, requireUnicodeSupport, IsWiffFile());
92  }
93  catch (exception& e)
94  {
95  TEST_FAILED(e.what())
96  }
97  catch (...)
98  {
99  TEST_FAILED("Caught unknown exception.")
100  }
101 
103 }

References CVID_Unknown, MS_electron_multiplier, MS_ionization_type, MS_quadrupole, TEST_EPILOG, TEST_FAILED, TEST_PROLOG, pwiz::util::testReader(), pwiz::msdata::detail::Thermo::translateAsInstrumentModel(), and unit_assert.

pwiz::msdata::detail::Thermo::translateAsInstrumentModel
PWIZ_API_DECL CVID translateAsInstrumentModel(InstrumentModelType instrumentModelType)
pwiz::msdata
Definition: DemuxTypes.hpp:27
pwiz::msdata::detail
Definition: ChromatogramList_ABI.hpp:35
MS_ionization_type
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:285
pwiz::util
Definition: almost_equal.hpp:33
TEST_EPILOG
#define TEST_EPILOG
Definition: unit.hpp:183
CVID_Unknown
CVID_Unknown
Definition: cv.hpp:114
pwiz::msdata::Reader_ABI
Definition: Reader_ABI.hpp:42
TEST_FAILED
#define TEST_FAILED(x)
Definition: unit.hpp:177
TEST_PROLOG
#define TEST_PROLOG(argc, argv)
Definition: unit.hpp:175
unit_assert
#define unit_assert(x)
Definition: unit.hpp:85
pwiz::msdata::InstrumentConfigurationPtr
boost::shared_ptr< InstrumentConfiguration > InstrumentConfigurationPtr
Definition: MSData.hpp:250
MS_quadrupole
MS_quadrupole
quadrupole: A mass spectrometer that consists of four parallel rods whose centers form the corners of...
Definition: cv.hpp:543
MS_electron_multiplier
MS_electron_multiplier
electron multiplier: A device to amplify the current of a beam or packet of charged particles or phot...
Definition: cv.hpp:1212
IsWiffFile
Definition: Reader_ABI_Test.cpp:33
pwiz::util::testReader
PWIZ_API_DECL int testReader(const pwiz::msdata::Reader &reader, const std::vector< std::string > &args, bool testAcceptOnly, bool requireUnicodeSupport, const TestPathPredicate &isPathTestable, const ReaderTestConfig &config=ReaderTestConfig())
A common test harness for vendor readers;.