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 41 of file Reader_ABI_Test.cpp.

References CVID_Unknown, boost::lexical_cast(), 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.

42 {
43  TEST_PROLOG(argc, argv)
44 
45  #ifdef PWIZ_READER_ABI
46  const bool testAcceptOnly = false;
47  #else
48  const bool testAcceptOnly = true;
49  #endif
50 
51  try
52  {
53  #ifdef PWIZ_READER_ABI
54 
55  using namespace pwiz::msdata;
56  using namespace pwiz::msdata::detail;
57  using namespace pwiz::msdata::detail::ABI;
58  using namespace pwiz::util;
59 
60  // test that all instrument types are handled by translation functions (skipping the 'Unknown' type)
61  bool allInstrumentTestsPassed = true;
62  for (int i = 1; i < (int) InstrumentModel_Count; ++i)
63  {
64  InstrumentModel model = (InstrumentModel) i;
65 
66  try
67  {
69 
70  InstrumentConfigurationPtr configuration = translateAsInstrumentConfiguration(model, IonSourceType_Unknown);
71 
72  unit_assert(configuration->componentList.source(0).hasCVParam(MS_ionization_type));
73  unit_assert(configuration->componentList.analyzer(0).hasCVParam(MS_quadrupole));
74  unit_assert(configuration->componentList.detector(0).hasCVParam(MS_electron_multiplier));
75  }
76  catch (runtime_error& e)
77  {
78  cerr << "Unit test failed for instrument model " << lexical_cast<string>(model) << ":\n" << e.what() << endl;
79  allInstrumentTestsPassed = false;
80  }
81  }
82 
83  unit_assert(allInstrumentTestsPassed);
84  #endif
85 
86  bool requireUnicodeSupport = true;
87  pwiz::util::testReader(pwiz::msdata::Reader_ABI(), testArgs, testAcceptOnly, requireUnicodeSupport, IsWiffFile());
88  }
89  catch (exception& e)
90  {
91  TEST_FAILED(e.what())
92  }
93  catch (...)
94  {
95  TEST_FAILED("Caught unknown exception.")
96  }
97 
99 }
PWIZ_API_DECL CVID translateAsInstrumentModel(InstrumentModelType instrumentModelType)
#define TEST_EPILOG
Definition: unit.hpp:182
MS_electron_multiplier
electron multiplier: A device to amplify the current of a beam or packet of charged particles or phot...
Definition: cv.hpp:1060
float lexical_cast(const std::string &str)
PWIZ_API_DECL int testReader(const pwiz::msdata::Reader &reader, const std::vector< std::string > &args, bool testAcceptOnly, bool requireUnicodeSupport, const TestPathPredicate &isPathTestable)
A common test harness for vendor readers;.
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:124
boost::shared_ptr< InstrumentConfiguration > InstrumentConfigurationPtr
Definition: MSData.hpp:249
#define TEST_FAILED(x)
Definition: unit.hpp:176
CVID_Unknown
Definition: cv.hpp:97
#define TEST_PROLOG(argc, argv)
Definition: unit.hpp:174
MS_quadrupole
quadrupole: A mass spectrometer that consists of four parallel rods whose centers form the corners of...
Definition: cv.hpp:382
#define unit_assert(x)
Definition: unit.hpp:85