ProteoWizard
Functions | Variables
SpectrumInfoTest.cpp File Reference
#include "SpectrumInfo.hpp"
#include "pwiz/data/msdata/examples.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 test ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_ = 0
 
const double epsilon_ = 1e-6
 

Function Documentation

◆ test()

void test ( )

Definition at line 40 of file SpectrumInfoTest.cpp.

41{
42 if (os_) *os_ << "test()\n";
43
44 MSData tiny;
46
47 SpectrumInfo info;
48 info.update(*tiny.run.spectrumListPtr->spectrum(0));
49
50 unit_assert(info.index == 0);
51 unit_assert(info.id == "scan=19");
52 unit_assert(info.scanNumber == 19);
54 unit_assert(info.msLevel == 1);
56 unit_assert_equal(info.mzLow, 400.39, epsilon_);
57 unit_assert_equal(info.mzHigh, 1795.56, epsilon_);
58 unit_assert(info.precursors.empty());
59
60 info.update(*tiny.run.spectrumListPtr->spectrum(0), true);
61 unit_assert(info.data.size() == 15);
62
63 info.update(*tiny.run.spectrumListPtr->spectrum(0), false);
64 unit_assert(info.data.size() == 0);
65 unit_assert(info.data.capacity() == 0);
66
67 info.update(*tiny.run.spectrumListPtr->spectrum(1), true);
68 unit_assert(info.index == 1);
69 unit_assert(info.id == "scan=20");
70 unit_assert(info.scanNumber == 20);
72 unit_assert(info.msLevel == 2);
74 unit_assert_equal(info.mzLow, 320.39, epsilon_);
75 unit_assert_equal(info.mzHigh, 1003.56, epsilon_);
76 unit_assert(info.precursors.size() == 1);
77 unit_assert(info.precursors[0].index == 0);
78 unit_assert_equal(info.precursors[0].mz, 445.34, epsilon_);
79 unit_assert_equal(info.precursors[0].intensity, 120053, epsilon_);
80 unit_assert(info.precursors[0].charge == 2);
81 unit_assert(info.data.size() == 10);
82
83 info.clearBinaryData();
84 unit_assert(info.data.size() == 0);
85 unit_assert(info.data.capacity() == 0);
86
87 if (os_) *os_ << "ok\n";
88}
const double epsilon_
ostream * os_
MS_QIT
QIT (quadrupole ion trap): Quadrupole Ion Trap mass analyzer captures the ions in a three dimensional...
Definition cv.hpp:552
PWIZ_API_DECL void initializeTiny(MSData &msd)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition MSData.hpp:850
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
Definition MSData.hpp:886
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here....
Definition MSData.hpp:827
simple structure for holding Spectrum info
std::vector< PrecursorInfo > precursors
void update(const Spectrum &spectrum, bool getBinaryData=false)
std::vector< MZIntensityPair > data
#define unit_assert(x)
Definition unit.hpp:85
#define unit_assert_equal(x, y, epsilon)
Definition unit.hpp:99

References pwiz::msdata::SpectrumInfo::clearBinaryData(), pwiz::msdata::SpectrumInfo::data, epsilon_, pwiz::msdata::SpectrumInfo::id, pwiz::msdata::SpectrumInfo::index, pwiz::msdata::examples::initializeTiny(), pwiz::msdata::SpectrumInfo::massAnalyzerType, MS_QIT, pwiz::msdata::SpectrumInfo::msLevel, pwiz::msdata::SpectrumInfo::mzHigh, pwiz::msdata::SpectrumInfo::mzLow, os_, pwiz::msdata::SpectrumInfo::precursors, pwiz::msdata::SpectrumInfo::retentionTime, pwiz::msdata::MSData::run, pwiz::msdata::SpectrumInfo::scanNumber, pwiz::msdata::Run::spectrumListPtr, unit_assert, unit_assert_equal, and pwiz::msdata::SpectrumInfo::update().

Referenced by main().

◆ main()

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

Definition at line 91 of file SpectrumInfoTest.cpp.

92{
93 TEST_PROLOG(argc, argv)
94
95 try
96 {
97 if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
98 test();
99 }
100 catch (exception& e)
101 {
102 TEST_FAILED(e.what())
103 }
104 catch (...)
105 {
106 TEST_FAILED("Caught unknown exception.")
107 }
108
110}
void test()
#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 os_, test(), TEST_EPILOG, TEST_FAILED, and TEST_PROLOG.

Variable Documentation

◆ os_

ostream* os_ = 0

Definition at line 36 of file SpectrumInfoTest.cpp.

Referenced by main(), and test().

◆ epsilon_

const double epsilon_ = 1e-6

Definition at line 37 of file SpectrumInfoTest.cpp.

Referenced by test().