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

void test ( )

Definition at line 40 of file SpectrumInfoTest.cpp.

References pwiz::msdata::SpectrumInfo::clearBinaryData(), pwiz::msdata::SpectrumInfo::data, epsilon_, pwiz::msdata::SpectrumInfo::id, pwiz::msdata::SpectrumInfo::index, pwiz::identdata::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().

{
if (os_) *os_ << "test()\n";
MSData tiny;
info.update(*tiny.run.spectrumListPtr->spectrum(0));
unit_assert(info.index == 0);
unit_assert(info.id == "scan=19");
unit_assert(info.scanNumber == 19);
unit_assert(info.msLevel == 1);
unit_assert(info.precursors.empty());
info.update(*tiny.run.spectrumListPtr->spectrum(0), true);
unit_assert(info.data.size() == 15);
info.update(*tiny.run.spectrumListPtr->spectrum(0), false);
unit_assert(info.data.size() == 0);
unit_assert(info.data.capacity() == 0);
info.update(*tiny.run.spectrumListPtr->spectrum(1), true);
unit_assert(info.index == 1);
unit_assert(info.id == "scan=20");
unit_assert(info.scanNumber == 20);
unit_assert(info.msLevel == 2);
unit_assert(info.precursors.size() == 1);
unit_assert(info.precursors[0].index == 0);
unit_assert_equal(info.precursors[0].mz, 445.34, epsilon_);
unit_assert_equal(info.precursors[0].intensity, 120053, epsilon_);
unit_assert(info.precursors[0].charge == 2);
unit_assert(info.data.size() == 10);
unit_assert(info.data.size() == 0);
unit_assert(info.data.capacity() == 0);
if (os_) *os_ << "ok\n";
}
int main ( int  argc,
char *  argv[] 
)

Definition at line 91 of file SpectrumInfoTest.cpp.

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

{
TEST_PROLOG(argc, argv)
try
{
if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
test();
}
catch (exception& e)
{
TEST_FAILED(e.what())
}
catch (...)
{
TEST_FAILED("Caught unknown exception.")
}
}

Variable Documentation

ostream* os_ = 0

Definition at line 36 of file SpectrumInfoTest.cpp.

const double epsilon_ = 1e-6

Definition at line 37 of file SpectrumInfoTest.cpp.