ProteoWizard
Macros | Functions | Variables
Serializer_mzid_Test.cpp File Reference
#include "pwiz/utility/misc/unit.hpp"
#include "pwiz/utility/misc/Std.hpp"
#include "IdentData.hpp"
#include "Serializer_mzid.hpp"
#include "examples.hpp"
#include "Diff.hpp"

Go to the source code of this file.

Macros

#define PWIZ_SOURCE
 

Functions

void testSerialize ()
 
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_mzid_Test.cpp.

Function Documentation

void testSerialize ( )

Definition at line 41 of file Serializer_mzid_Test.cpp.

References diff(), pwiz::identdata::examples::initializeTiny(), os_, pwiz::identdata::Serializer_mzIdentML::read(), unit_assert, and pwiz::identdata::Serializer_mzIdentML::write().

Referenced by main(), and test().

42 {
43  if (os_) *os_ << "begin testSerialize\n";
44  IdentData mzid;
45  initializeTiny(mzid);
46 
48  ostringstream oss;
49  ser.write(oss, mzid);
50 
51  if (os_) *os_ << oss.str() << endl;
52 
53  IdentData mzid2;
54  boost::shared_ptr<istream> iss(new istringstream(oss.str()));
55  ser.read(iss, mzid2);
56  Diff<IdentData, DiffConfig> diff(mzid, mzid2);
57 
58  if (os_ && diff) *os_ << diff << endl;
59  unit_assert(!diff);
60 }
void test ( )

Definition at line 62 of file Serializer_mzid_Test.cpp.

References testSerialize().

63 {
64  testSerialize();
65 }
int main ( int  argc,
char **  argv 
)

Definition at line 67 of file Serializer_mzid_Test.cpp.

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

68 {
69  TEST_PROLOG(argc, argv)
70 
71  try
72  {
73  if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
74  test();
75  }
76  catch (exception& e)
77  {
78  TEST_FAILED(e.what())
79  }
80  catch (...)
81  {
82  TEST_FAILED("Caught unknown exception.")
83  }
84 
86 }

Variable Documentation

ostream* os_ = 0

Definition at line 38 of file Serializer_mzid_Test.cpp.