ProteoWizard
Macros | Functions | Variables
Serializer_Text_Test.cpp File Reference
#include "pwiz/utility/misc/unit.hpp"
#include "IdentData.hpp"
#include "Serializer_Text.hpp"
#include "TextWriter.hpp"
#include "examples.hpp"
#include "pwiz/utility/misc/Std.hpp"

Go to the source code of this file.

Macros

#define PWIZ_SOURCE

Functions

void testSerializeRead ()
void testSerializeWrite ()
void test ()
int main (int argc, char **argv)

Variables

ostream * os_ = 0

Macro Definition Documentation

#define PWIZ_SOURCE

Definition at line 23 of file Serializer_Text_Test.cpp.


Function Documentation

void testSerializeRead ( )

Definition at line 37 of file Serializer_Text_Test.cpp.

References os_, and pwiz::identdata::Serializer_Text::read().

Referenced by test().

{
if (os_)
(*os_) << "*** Beginning testSerializeRead() ***\n";
string testStr = "scan\trt\tmz\tscore\tscoretype\tpeptide\tprotein\n"
"1\t1.01\t100.1\t0.5\tmascot\tVAGWE\tvague protein\n"
"2\t2.02\t200.0\t0.9\tmascot\tCERTAIN\tcertain protein\n";
shared_ptr<istringstream> iss(new istringstream(testStr));
IdentData mzid;
Serializer_Text serializer;
serializer.read(iss, mzid);
if (os_)
{
(*os_) << "mzIdentML output:\n";
tw(mzid);
}
if (os_)
(*os_) << "*** Ending testSerializeRead() ***\n";
}
void testSerializeWrite ( )

Definition at line 64 of file Serializer_Text_Test.cpp.

References pwiz::identdata::examples::initializeBasicSpectrumIdentification(), os_, and pwiz::identdata::Serializer_Text::write().

Referenced by test().

{
if (os_)
(*os_) << "*** Beginning testSerializeWrite() ***\n";
ostringstream oss;
IdentData mzid;
Serializer_Text serializer;
serializer.write(oss, mzid);
if (os_)
(*os_) << oss.str() << endl;
if (os_)
(*os_) << "*** Ending testSerializeRead() ***\n";
}
void test ( )
int main ( int  argc,
char **  argv 
)

Definition at line 89 of file Serializer_Text_Test.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 35 of file Serializer_Text_Test.cpp.