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

§ PWIZ_SOURCE

#define PWIZ_SOURCE

Definition at line 23 of file Serializer_mzid_Test.cpp.

Function Documentation

§ testSerialize()

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 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 write(std::ostream &os, const IdentData &mzid, const pwiz::util::IterationListenerRegistry *=0) const
write MZIDData object to ostream as mzIdentML
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
ostream * os_
void diff(const string &filename1, const string &filename2)
Implementation of the MzIdentMLType from the mzIdentML schema.
Definition: IdentData.hpp:993
void read(boost::shared_ptr< std::istream > is, IdentData &mzid, const pwiz::util::IterationListenerRegistry *=0) const
read in MZIDData object from a mzIdentML istream
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
MZIDData <-> mzIdentML stream serialization.
#define unit_assert(x)
Definition: unit.hpp:85

§ test()

void test ( )

Definition at line 62 of file Serializer_mzid_Test.cpp.

References testSerialize().

Referenced by main().

63 {
64  testSerialize();
65 }
void testSerialize()

§ main()

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 }
#define TEST_EPILOG
Definition: unit.hpp:182
ostream * os_
void test()
#define TEST_FAILED(x)
Definition: unit.hpp:176
#define TEST_PROLOG(argc, argv)
Definition: unit.hpp:174

Variable Documentation

§ os_

ostream* os_ = 0

Definition at line 38 of file Serializer_mzid_Test.cpp.

Referenced by main(), and testSerialize().