ProteoWizard
Functions | Variables
SpectrumListFactoryTest.cpp File Reference
#include "SpectrumListFactory.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "pwiz/utility/misc/Std.hpp"
#include <cstring>

Go to the source code of this file.

Functions

void testUsage ()
 
void testWrap ()
 
void testWrapScanTimeRange ()
 
void testWrapSortScanTime ()
 
void testWrapMZWindow ()
 
void testWrapMSLevel ()
 
void testWrapChargeState ()
 
void testWrapDefaultArrayLength ()
 
void testWrapActivation ()
 
void testWrapMassAnalyzer ()
 
void testWrapPolarity ()
 
void testWrapTitleMaker ()
 
void test ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_ = 0
 

Function Documentation

§ testUsage()

void testUsage ( )

Definition at line 39 of file SpectrumListFactoryTest.cpp.

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

Referenced by test().

40 {
41  if (os_) *os_ << "SpectrumListFactory::usage():\n" << SpectrumListFactory::usage() << endl;
42 }
ostream * os_

§ testWrap()

void testWrap ( )

Definition at line 45 of file SpectrumListFactoryTest.cpp.

References pwiz::msdata::MSData::allDataProcessingPtrs(), pwiz::identdata::examples::initializeTiny(), pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, unit_assert, unit_assert_operator_equal, and pwiz::analysis::SpectrumListFactory::wrap().

Referenced by test().

46 {
47  MSData msd;
49 
51 
52  unit_assert(sl.get());
53  unit_assert(sl->size() > 2);
54 
55  // CompassXtract and pwiz data processing
57  unit_assert_operator_equal(1, msd.allDataProcessingPtrs()[1]->processingMethods.size());
58 
59  SpectrumListFactory::wrap(msd, "scanNumber [19,20]");
60  unit_assert(sl->size() == 2);
61 
62  // make sure we can handle config file lines copied from commandline
63  // with quotes intact
64  SpectrumListFactory::wrap(msd, "'index [1,1]'");
65  unit_assert(sl->size() == 1);
66  unit_assert(sl->spectrumIdentity(0).id == "scan=20");
67 
68  vector<double> profileData(sl->spectrum(0)->getMZArray()->data);
69  unit_assert(profileData.size() == 10);
70  unit_assert(profileData[0] == 0);
71  unit_assert(profileData[9] == 18);
72 
74  unit_assert_operator_equal(1, msd.allDataProcessingPtrs()[1]->processingMethods.size());
75 
76  SpectrumListFactory::wrap(msd, "peakPicking true [1,6]"); // backwards compatible syntax
77  SpectrumListFactory::wrap(msd, "peakPicking false"); // backwards compatible syntax
78  SpectrumListFactory::wrap(msd, "peakPicking cwt msLevel=[1,6]");
79  SpectrumListFactory::wrap(msd, "peakPicking cwt snr=1.2 msLevel=2-");
80  SpectrumListFactory::wrap(msd, "peakPicking cwt peakSpace=0.05");
81 
82  vector<double> peakData(sl->spectrum(0)->getMZArray()->data);
83  unit_assert(peakData.size() == 1);
84  unit_assert(peakData[0] == 0);
85 
87  unit_assert_operator_equal(6, msd.allDataProcessingPtrs()[1]->processingMethods.size());
88 }
#define unit_assert_operator_equal(expected, actual)
Definition: unit.hpp:92
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
boost::shared_ptr< SpectrumList > SpectrumListPtr
Definition: MSData.hpp:707
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
std::vector< DataProcessingPtr > allDataProcessingPtrs() const
return dataProcessingPtrs augmented by the dataProcessingPtr() set in SpectrumList and/or Chromatogra...
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
#define unit_assert(x)
Definition: unit.hpp:85

§ testWrapScanTimeRange()

void testWrapScanTimeRange ( )

Definition at line 91 of file SpectrumListFactoryTest.cpp.

References pwiz::identdata::examples::initializeTiny(), pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, unit_assert, and pwiz::analysis::SpectrumListFactory::wrap().

Referenced by test().

92 {
93  MSData msd;
95 
97  unit_assert(sl.get());
98  unit_assert(sl->size() > 2);
99 
100  double timeHighInSeconds = 5.9 * 60; // between first and second scan
101  ostringstream oss;
102  oss << "scanTime [0," << timeHighInSeconds << "]";
103  SpectrumListFactory::wrap(msd, oss.str());
104  unit_assert(sl->size() == 2);
105  unit_assert(sl->spectrumIdentity(0).id == "scan=19");
106  unit_assert(sl->spectrumIdentity(1).id == "sample=1 period=1 cycle=23 experiment=1"); // not in scan time order (42 seconds)
107 }
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
boost::shared_ptr< SpectrumList > SpectrumListPtr
Definition: MSData.hpp:707
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
#define unit_assert(x)
Definition: unit.hpp:85

§ testWrapSortScanTime()

void testWrapSortScanTime ( )

Definition at line 110 of file SpectrumListFactoryTest.cpp.

References pwiz::identdata::examples::initializeTiny(), MS_scan_start_time, pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, unit_assert, UO_minute, UO_second, and pwiz::analysis::SpectrumListFactory::wrap().

Referenced by test().

111 {
112  MSData msd;
114 
116  unit_assert(sl.get());
117  unit_assert(sl->size() == 5);
118 
119  sl->spectrum(0)->scanList.scans[0].set(MS_scan_start_time, 35, UO_second);
120  sl->spectrum(2)->scanList.scans[0].set(MS_scan_start_time, 0.5, UO_minute);
121 
122  SpectrumListFactory::wrap(msd, "sortByScanTime");
123  unit_assert(sl->size() == 5);
124  unit_assert(sl->spectrumIdentity(0).id == "scan=21");
125  unit_assert(sl->spectrumIdentity(1).id == "scan=19");
126  unit_assert(sl->spectrumIdentity(2).id == "sample=1 period=1 cycle=23 experiment=1");
127 }
MS_scan_start_time
scan start time: The time that an analyzer started a scan, relative to the start of the MS run...
Definition: cv.hpp:148
UO_second
second: A time unit which is equal to the duration of 9 192 631 770 periods of the radiation correspo...
Definition: cv.hpp:12526
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
boost::shared_ptr< SpectrumList > SpectrumListPtr
Definition: MSData.hpp:707
UO_minute
minute: A time unit which is equal to 60 seconds.
Definition: cv.hpp:12589
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
#define unit_assert(x)
Definition: unit.hpp:85

§ testWrapMZWindow()

void testWrapMZWindow ( )

Definition at line 130 of file SpectrumListFactoryTest.cpp.

References pwiz::identdata::examples::initializeTiny(), pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, unit_assert, and pwiz::analysis::SpectrumListFactory::wrap().

Referenced by test().

131 {
132  MSData msd;
134 
136  unit_assert(sl.get() && sl->size()>2);
137  SpectrumPtr spectrum = sl->spectrum(0, true);
138  vector<MZIntensityPair> data;
139  spectrum->getMZIntensityPairs(data);
140  unit_assert(data.size() == 15);
141 
142  SpectrumListFactory::wrap(msd, "mzWindow [9.5,15]");
143 
144  spectrum = sl->spectrum(0, true);
145  spectrum->getMZIntensityPairs(data);
146  unit_assert(data.size() == 5);
147 
148  spectrum = sl->spectrum(1, true);
149  spectrum->getMZIntensityPairs(data);
150  unit_assert(data.size() == 3);
151 }
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:569
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
boost::shared_ptr< SpectrumList > SpectrumListPtr
Definition: MSData.hpp:707
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
#define unit_assert(x)
Definition: unit.hpp:85

§ testWrapMSLevel()

void testWrapMSLevel ( )

Definition at line 154 of file SpectrumListFactoryTest.cpp.

References pwiz::identdata::examples::initializeTiny(), pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, unit_assert, unit_assert_operator_equal, and pwiz::analysis::SpectrumListFactory::wrap().

Referenced by test().

155 {
156  MSData msd;
158 
160  unit_assert(sl.get());
161  unit_assert_operator_equal(5, sl->size());
162 
163  SpectrumListFactory::wrap(msd, "msLevel 2");
164  unit_assert_operator_equal(2, sl->size());
165  unit_assert_operator_equal("scan=20", sl->spectrumIdentity(0).id);
166 }
#define unit_assert_operator_equal(expected, actual)
Definition: unit.hpp:92
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
boost::shared_ptr< SpectrumList > SpectrumListPtr
Definition: MSData.hpp:707
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
#define unit_assert(x)
Definition: unit.hpp:85

§ testWrapChargeState()

void testWrapChargeState ( )

Definition at line 169 of file SpectrumListFactoryTest.cpp.

References pwiz::identdata::examples::initializeTiny(), pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, unit_assert_operator_equal, and pwiz::analysis::SpectrumListFactory::wrap().

Referenced by test().

170 {
171  {
172  MSData msd;
175 
176  SpectrumListFactory::wrap(msd, "chargeState 2");
177  unit_assert_operator_equal(2, sl->size());
178  unit_assert_operator_equal("scan=20", sl->spectrumIdentity(0).id);
179 
180  SpectrumListFactory::wrap(msd, "chargeState 1");
181  unit_assert_operator_equal(0, sl->size());
182  }
183 
184  {
185  MSData msd;
188 
189  SpectrumListFactory::wrap(msd, "chargeState 0-2");
190  unit_assert_operator_equal(2, sl->size());
191  unit_assert_operator_equal("scan=20", sl->spectrumIdentity(0).id);
192  }
193 }
#define unit_assert_operator_equal(expected, actual)
Definition: unit.hpp:92
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
boost::shared_ptr< SpectrumList > SpectrumListPtr
Definition: MSData.hpp:707
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845

§ testWrapDefaultArrayLength()

void testWrapDefaultArrayLength ( )

Definition at line 196 of file SpectrumListFactoryTest.cpp.

References pwiz::identdata::examples::initializeTiny(), pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, unit_assert, and pwiz::analysis::SpectrumListFactory::wrap().

Referenced by test().

197 {
198  // test that the minimum length is 1 (due to 0 being the "unset" value)
199  {
200  MSData msd;
202 
204  unit_assert(sl.get());
205  unit_assert(sl->size() == 5);
206 
207  SpectrumListFactory::wrap(msd, "defaultArrayLength 0-");
208  unit_assert(sl->size() == 4);
209  unit_assert(sl->find("scan=21") == sl->size());
210  }
211 
212  // test filtering out all spectra
213  {
214  MSData msd;
217 
218  SpectrumListFactory::wrap(msd, "defaultArrayLength 100-");
219  unit_assert(sl->size() == 0);
220  }
221 
222  // test filtering out empty spectra
223  {
224  MSData msd;
227 
228  SpectrumListFactory::wrap(msd, "defaultArrayLength 1-");
229  unit_assert(sl->size() == 4);
230  unit_assert(sl->find("scan=21") == sl->size());
231  }
232 
233  // test filtering out spectra with defaultArrayLength > 14
234  {
235  MSData msd;
238 
239  SpectrumListFactory::wrap(msd, "defaultArrayLength 15-");
240  unit_assert(sl->size() == 2);
241  unit_assert(sl->find("scan=20") == sl->size());
242  unit_assert(sl->find("scan=21") == sl->size());
243  }
244 
245  // test filtering out spectra with 0 < defaultArrayLength < 15
246  {
247  MSData msd;
250 
251  SpectrumListFactory::wrap(msd, "defaultArrayLength 1-14");
252  unit_assert(sl->size() == 2);
253  unit_assert(sl->find("scan=20") == 0);
254  }
255 }
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
boost::shared_ptr< SpectrumList > SpectrumListPtr
Definition: MSData.hpp:707
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
#define unit_assert(x)
Definition: unit.hpp:85

§ testWrapActivation()

void testWrapActivation ( )

Definition at line 257 of file SpectrumListFactoryTest.cpp.

References pwiz::identdata::examples::initializeTiny(), pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, unit_assert, unit_assert_throws, and pwiz::analysis::SpectrumListFactory::wrap().

Referenced by test().

258 {
259  // test filter by CID activation
260  {
261  MSData msd;
263  SpectrumListFactory::wrap(msd, "msLevel 2-");
264  SpectrumListFactory::wrap(msd, "activation CID");
265  unit_assert(msd.run.spectrumListPtr->size() == 1);
266  }
267  // test filter by ETD activation
268  {
269  MSData msd;
271  SpectrumListFactory::wrap(msd, "msLevel 2-");
272  SpectrumListFactory::wrap(msd, "activation ETD");
273  unit_assert(msd.run.spectrumListPtr->size() == 1);
274  }
275  // test filter by HCD activation
276  {
277  MSData msd;
279  SpectrumListFactory::wrap(msd, "msLevel 2-");
280  SpectrumListFactory::wrap(msd, "activation HCD");
281  unit_assert(msd.run.spectrumListPtr->size() == 0);
282  }
283  // test filter by IRMPD activation
284  {
285  MSData msd;
287  SpectrumListFactory::wrap(msd, "msLevel 2-");
288  SpectrumListFactory::wrap(msd, "activation IRMPD");
289  unit_assert(msd.run.spectrumListPtr->size() == 0);
290  }
291  // test invalid argument
292  {
293  MSData msd;
295 
296  unit_assert_throws(SpectrumListFactory::wrap(msd, "activation UNEXPECTED_INPUT"), runtime_error);
297  }
298 }
#define unit_assert_throws(x, exception)
Definition: unit.hpp:106
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
#define unit_assert(x)
Definition: unit.hpp:85

§ testWrapMassAnalyzer()

void testWrapMassAnalyzer ( )

Definition at line 300 of file SpectrumListFactoryTest.cpp.

References pwiz::identdata::examples::initializeTiny(), pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, unit_assert, unit_assert_throws, and pwiz::analysis::SpectrumListFactory::wrap().

Referenced by test().

301 {
302  // test filter by ITMS analyzer type
303  {
304  MSData msd;
306 
307  SpectrumListFactory::wrap(msd, "analyzerType ITMS");
308  unit_assert(msd.run.spectrumListPtr->size() == 5);
309  }
310  // test filter by ITMS analyzer type (new syntax)
311  {
312  MSData msd;
314 
315  SpectrumListFactory::wrap(msd, "analyzerType it");
316  unit_assert(msd.run.spectrumListPtr->size() == 5);
317  }
318  // test filter by FTMS analyzer type
319  {
320  MSData msd;
322 
323  SpectrumListFactory::wrap(msd, "analyzer FTMS");
324  unit_assert(msd.run.spectrumListPtr->size() == 0);
325  }
326  // test filter by Orbi analyzer type
327  {
328  MSData msd;
330 
331  SpectrumListFactory::wrap(msd, "analyzer Orbi");
332  unit_assert(msd.run.spectrumListPtr->size() == 0);
333  }
334  // test filter by TOF analyzer type
335  {
336  MSData msd;
338 
339  SpectrumListFactory::wrap(msd, "analyzer TOF");
340  unit_assert(msd.run.spectrumListPtr->size() == 0);
341  }
342  // test invalid argument
343  {
344  MSData msd;
346 
347  unit_assert_throws(SpectrumListFactory::wrap(msd, "analyzer UNEXPECTED_INPUT"), runtime_error)
348  }
349 }
#define unit_assert_throws(x, exception)
Definition: unit.hpp:106
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
#define unit_assert(x)
Definition: unit.hpp:85

§ testWrapPolarity()

void testWrapPolarity ( )

Definition at line 351 of file SpectrumListFactoryTest.cpp.

References pwiz::identdata::examples::initializeTiny(), pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, unit_assert, unit_assert_throws, and pwiz::analysis::SpectrumListFactory::wrap().

Referenced by test().

352 {
353  // test filter by positive polarity
354  {
355  MSData msd;
357 
359  unit_assert(sl.get());
360  unit_assert(sl->size() == 5);
361 
362  SpectrumListFactory::wrap(msd, "polarity positive");
363  unit_assert(sl->size() == 3);
364  }
365  // test filter by + polarity
366  {
367  MSData msd;
369 
371  unit_assert(sl.get());
372  unit_assert(sl->size() == 5);
373 
374  SpectrumListFactory::wrap(msd, "polarity +");
375  unit_assert(sl->size() == 3);
376  }
377  // test filter by negative polarity
378  {
379  MSData msd;
381 
383  unit_assert(sl.get());
384  unit_assert(sl->size() == 5);
385 
386  SpectrumListFactory::wrap(msd, "polarity -");
387  unit_assert(sl->size() == 2);
388  }
389  // test invalid argument
390  {
391  MSData msd;
393 
395  unit_assert(sl.get());
396  unit_assert(sl->size() == 5);
397  unit_assert_throws(SpectrumListFactory::wrap(msd, "polarity UNEXPECTED_INPUT"), runtime_error)
398  }
399 }
#define unit_assert_throws(x, exception)
Definition: unit.hpp:106
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
boost::shared_ptr< SpectrumList > SpectrumListPtr
Definition: MSData.hpp:707
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
#define unit_assert(x)
Definition: unit.hpp:85

§ testWrapTitleMaker()

void testWrapTitleMaker ( )

Definition at line 401 of file SpectrumListFactoryTest.cpp.

References pwiz::identdata::examples::initializeTiny(), MS_spectrum_title, pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, unit_assert_operator_equal, and pwiz::analysis::SpectrumListFactory::wrap().

Referenced by test().

402 {
403  MSData msd;
405 
406  {
407  SpectrumListFactory::wrap(msd, "titleMaker <Id>");
409  unit_assert_operator_equal("scan=19", sl->spectrum(0)->cvParam(MS_spectrum_title).value);
410  unit_assert_operator_equal("scan=20", sl->spectrum(1)->cvParam(MS_spectrum_title).value);
411  unit_assert_operator_equal("scan=21", sl->spectrum(2)->cvParam(MS_spectrum_title).value);
412  unit_assert_operator_equal("scan=22", sl->spectrum(3)->cvParam(MS_spectrum_title).value);
413  unit_assert_operator_equal("sample=1 period=1 cycle=23 experiment=1", sl->spectrum(4)->cvParam(MS_spectrum_title).value);
414  }
415 
416  {
417  // the outer titleMaker overrides the inner one
418  SpectrumListFactory::wrap(msd, "titleMaker <Index>; <SpectrumType>, <MsLevel>");
420  unit_assert_operator_equal("0; MS1 spectrum, 1", sl->spectrum(0)->cvParam(MS_spectrum_title).value);
421  unit_assert_operator_equal("1; MSn spectrum, 2", sl->spectrum(1)->cvParam(MS_spectrum_title).value);
422  unit_assert_operator_equal("2; MS1 spectrum, 1", sl->spectrum(2)->cvParam(MS_spectrum_title).value);
423  unit_assert_operator_equal("3; MSn spectrum, 2", sl->spectrum(3)->cvParam(MS_spectrum_title).value);
424  unit_assert_operator_equal("4; MS1 spectrum, 1", sl->spectrum(4)->cvParam(MS_spectrum_title).value);
425  }
426 
427  {
428  SpectrumListFactory::wrap(msd, "titleMaker <ScanNumber> <MsLevel> <ActivationType> <ChargeState> <PrecursorSpectrumId>");
430  unit_assert_operator_equal("19 1 ", sl->spectrum(0)->cvParam(MS_spectrum_title).value);
431  unit_assert_operator_equal("20 2 CID 2 scan=19", sl->spectrum(1)->cvParam(MS_spectrum_title).value);
432  unit_assert_operator_equal("21 1 ", sl->spectrum(2)->cvParam(MS_spectrum_title).value);
433  unit_assert_operator_equal("22 2 ETD/CID 2 scan=19", sl->spectrum(3)->cvParam(MS_spectrum_title).value);
434  unit_assert_operator_equal("5 1 ", sl->spectrum(4)->cvParam(MS_spectrum_title).value);
435  }
436 }
#define unit_assert_operator_equal(expected, actual)
Definition: unit.hpp:92
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
boost::shared_ptr< SpectrumList > SpectrumListPtr
Definition: MSData.hpp:707
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
MS_spectrum_title
spectrum title: A free-form text title describing a spectrum.
Definition: cv.hpp:2923
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845

§ test()

void test ( )

Definition at line 438 of file SpectrumListFactoryTest.cpp.

References testUsage(), testWrap(), testWrapActivation(), testWrapChargeState(), testWrapDefaultArrayLength(), testWrapMassAnalyzer(), testWrapMSLevel(), testWrapMZWindow(), testWrapPolarity(), testWrapScanTimeRange(), testWrapSortScanTime(), and testWrapTitleMaker().

Referenced by main().

439 {
440  testUsage();
441  testWrap();
445  testWrapMSLevel();
452 }
void testWrapScanTimeRange()
void testWrapMassAnalyzer()
void testWrapTitleMaker()
void testWrapActivation()
void testWrapDefaultArrayLength()
void testUsage()
void testWrap()
void testWrapMZWindow()
void testWrapMSLevel()
void testWrapChargeState()
void testWrapSortScanTime()
void testWrapPolarity()

§ main()

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

Definition at line 455 of file SpectrumListFactoryTest.cpp.

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

456 {
457  TEST_PROLOG(argc, argv)
458 
459  try
460  {
461  if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
462  test();
463  }
464  catch (exception& e)
465  {
466  TEST_FAILED(e.what())
467  }
468  catch (...)
469  {
470  TEST_FAILED("Caught unknown exception.")
471  }
472 
474 }
#define TEST_EPILOG
Definition: unit.hpp:182
ostream * os_
#define TEST_FAILED(x)
Definition: unit.hpp:176
#define TEST_PROLOG(argc, argv)
Definition: unit.hpp:174

Variable Documentation

§ os_

ostream* os_ = 0

Definition at line 36 of file SpectrumListFactoryTest.cpp.

Referenced by main(), and testUsage().