ProteoWizard
Functions | Variables
Serializer_mzXML_Test.cpp File Reference
#include "Serializer_mzXML.hpp"
#include "Serializer_mzML.hpp"
#include "Diff.hpp"
#include "TextWriter.hpp"
#include "examples.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "boost/iostreams/positioning.hpp"
#include "pwiz/utility/misc/Std.hpp"
#include <cstring>

Go to the source code of this file.

Functions

void testWriteRead (const MSData &msd, const Serializer_mzXML::Config &config)
void testWriteRead ()
int main (int argc, char *argv[])

Variables

ostream * os_ = 0

Function Documentation

void testWriteRead ( const MSData msd,
const Serializer_mzXML::Config config 
)

Definition at line 44 of file Serializer_mzXML_Test.cpp.

References diff(), pwiz::msdata::DiffConfig::ignoreChromatograms, pwiz::msdata::DiffConfig::ignoreMetadata, os_, pwiz::msdata::Serializer_mzXML::read(), unit_assert, pwiz::msdata::Serializer_mzXML::write(), pwiz::msdata::Serializer_mzML::write(), and write().

{
if (os_) *os_ << "testWriteRead() " << config << endl;
Serializer_mzXML mzxmlSerializer(config);
ostringstream oss;
mzxmlSerializer.write(oss, msd);
if (os_) *os_ << "oss:\n" << oss.str() << endl;
shared_ptr<istringstream> iss(new istringstream(oss.str()));
MSData msd2;
mzxmlSerializer.read(iss, msd2);
DiffConfig diffConfig;
diffConfig.ignoreMetadata = true;
diffConfig.ignoreChromatograms = true;
Diff<MSData, DiffConfig> diff(msd, msd2, diffConfig);
if (os_ && diff) *os_ << diff << endl;
if (os_)
{
*os_ << "msd2:\n";
Serializer_mzML mzmlSerializer;
mzmlSerializer.write(*os_, msd2);
*os_ << endl;
*os_ << "msd2::";
write(msd2);
*os_ << endl;
}
}
void testWriteRead ( )
int main ( int  argc,
char *  argv[] 
)

Definition at line 103 of file Serializer_mzXML_Test.cpp.

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

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

Variable Documentation

ostream* os_ = 0

Definition at line 41 of file Serializer_mzXML_Test.cpp.