ProteoWizard
Functions | Variables
Serializer_protXML_Test.cpp File Reference
#include "pwiz/utility/misc/Std.hpp"
#include "pwiz/data/identdata/DefaultReaderList.hpp"
#include "pwiz/data/identdata/IdentDataFile.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "Serializer_protXML.hpp"
#include "Diff.hpp"
#include "References.hpp"
#include "examples.hpp"
#include "pwiz/utility/misc/Filesystem.hpp"
#include "pwiz/data/proteome/Digestion.hpp"
#include "TextWriter.hpp"
#include "boost/range/adaptor/transformed.hpp"
#include "boost/range/algorithm/max_element.hpp"
#include "boost/range/algorithm/min_element.hpp"
#include <cstring>

Go to the source code of this file.

Functions

void testSerialize (const string &example_data_dir)
int main (int argc, char **argv)

Variables

ostream * os_ = 0

Function Documentation

void testSerialize ( const string &  example_data_dir)

Definition at line 50 of file Serializer_protXML_Test.cpp.

References pwiz::data::BaseDiffConfig::ignoreVersions, os_, pwiz::identdata::ReaderList::read(), and unit_assert.

{
Reader::Config readerConfig;
DiffConfig diffconfig;
diffconfig.ignoreVersions = true;
{
// verify that loading protXML with reachable pepXML source files gives more
// (well, different) data than pepXML alone
IdentData mzid0,mzid1;
readers.read(example_data_dir+"/example.pep.xml", mzid0, readerConfig);
readers.read(example_data_dir+"/example.prot.xml", mzid1, readerConfig);
Diff<IdentData, DiffConfig> diff0(diffconfig);
diff0(mzid0, mzid1);
unit_assert(diff0);
}
{
// verify that adding protxml to pepXML is equivalent to loading protXML with reachable
// pepXML source files
IdentData mzid0,mzid1;
readers.read(example_data_dir+"/example.pep.xml", mzid0, readerConfig);
readers.read(example_data_dir+"/example.prot.xml", mzid0, readerConfig);
readers.read(example_data_dir+"/example.prot.xml", mzid1, readerConfig);
Diff<IdentData, DiffConfig> diff1(diffconfig);
diff1(mzid0, mzid1);
if (os_ && diff1) *os_ << diff1 << endl;
unit_assert(!diff1);
}
{
// verify that loading protXML is the same as loading a known-good mzIdentML file
IdentData mzid0,mzid1;
readers.read(example_data_dir+"/example.prot.xml", mzid0, readerConfig);
readers.read(example_data_dir+"/example.prot.mzid", mzid1, readerConfig);
Diff<IdentData, DiffConfig> diff2(diffconfig);
diff2(mzid0, mzid1);
if (os_ && diff2) *os_ << diff2 << endl;
else if (diff2) cout << diff2 << endl;
unit_assert(!diff2);
}
}
int main ( int  argc,
char **  argv 
)

Definition at line 95 of file Serializer_protXML_Test.cpp.

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

{
TEST_PROLOG(argc, argv)
try
{
if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
std::string srcparent(argv[0]);
size_t pos = srcparent.find("build");
if (pos == std::string::npos) {
srcparent = __FILE__; // nonstandard build, maybe? try using source file name
// something like \ProteoWizard\pwiz\pwiz\data\identdata\Serializer_ProtXML_Test.cpp
pos = srcparent.rfind("pwiz");
}
srcparent.resize(pos);
string example_data_dir = srcparent + "example_data";
testSerialize(example_data_dir);
}
catch (exception& e)
{
TEST_FAILED(e.what())
}
catch (...)
{
TEST_FAILED("Caught unknown exception.")
}
}

Variable Documentation

ostream* os_ = 0

Definition at line 48 of file Serializer_protXML_Test.cpp.