ProteoWizard
Functions | Variables
PeptideID_flatTest.cpp File Reference
#include "pwiz/utility/misc/Std.hpp"
#include <cstring>
#include "PeptideID_flat.hpp"
#include "pwiz/utility/minimxml/SAXParser.hpp"
#include "pwiz/utility/misc/unit.hpp"

Go to the source code of this file.

Functions

void testIStream ()
 
void testMSInspectIStream ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_
 
const char * sampleFlat
 
const char * sampleMSI
 

Function Documentation

§ testIStream()

void testIStream ( )

Definition at line 48 of file PeptideID_flatTest.cpp.

References pwiz::peptideid::PeptideID::Record::nativeID, pwiz::peptideid::PeptideID::Record::normalizedScore, pwiz::peptideid::PeptideID_flat::record(), sampleFlat, pwiz::peptideid::PeptideID::Record::sequence, unit_assert, and unit_assert_equal.

Referenced by main().

49 {
50  istringstream data (sampleFlat);
51 
52  PeptideID_flat ppFlat(&data, shared_ptr<FlatRecordBuilder>(new FlatRecordBuilder));
53 
54  PeptideID::Location loc("1", 1000., 0);
55  PeptideID::Record bf = ppFlat.record(loc);
56 
57  unit_assert(bf.nativeID == "1");
58  unit_assert(bf.sequence == "ABC");
59  unit_assert_equal(bf.normalizedScore, 0.9, 1e-14);
60 }
#define unit_assert_equal(x, y, epsilon)
Definition: unit.hpp:99
This class allows access to peptides listed in a flat tab delimited text file.
const char * sampleFlat
#define unit_assert(x)
Definition: unit.hpp:85

§ testMSInspectIStream()

void testMSInspectIStream ( )

Definition at line 62 of file PeptideID_flatTest.cpp.

References pwiz::peptideid::PeptideID::Record::nativeID, pwiz::peptideid::PeptideID::Record::normalizedScore, pwiz::peptideid::PeptideID_flat::record(), sampleMSI, pwiz::peptideid::PeptideID::Record::sequence, unit_assert, and unit_assert_equal.

Referenced by main().

63 {
64  istringstream data (sampleMSI);
65 
66  PeptideID_flat ppFlat(&data, shared_ptr<FlatRecordBuilder>(new MSInspectRecordBuilder()));
67 
68  PeptideID::Location loc("1", 2.248, 878.889);
69  PeptideID::Record bf = ppFlat.record(loc);
70 
71  unit_assert(bf.nativeID == "1");
72  unit_assert(bf.sequence == "");
73  unit_assert_equal(bf.normalizedScore, 0.05977635, 1e-14);
74 }
#define unit_assert_equal(x, y, epsilon)
Definition: unit.hpp:99
This class allows access to peptides listed in a flat tab delimited text file.
#define unit_assert(x)
Definition: unit.hpp:85
const char * sampleMSI

§ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 91 of file PeptideID_flatTest.cpp.

References os_, TEST_EPILOG, TEST_FAILED, TEST_PROLOG, testIStream(), and testMSInspectIStream().

92 {
93  TEST_PROLOG(argc, argv)
94 
95  try
96  {
97  if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
98  testIStream();
100  //testFilename();
101  //testDone();
102  //testBadXML();
103  //testNested();
104  }
105  catch (exception& e)
106  {
107  TEST_FAILED(e.what())
108  }
109  catch (...)
110  {
111  TEST_FAILED("Caught unknown exception.")
112  }
113 
115 }
void testIStream()
#define TEST_EPILOG
Definition: unit.hpp:182
void testMSInspectIStream()
#define TEST_FAILED(x)
Definition: unit.hpp:176
#define TEST_PROLOG(argc, argv)
Definition: unit.hpp:174
ostream * os_

Variable Documentation

§ os_

ostream* os_

Definition at line 34 of file PeptideID_flatTest.cpp.

Referenced by main().

§ sampleFlat

const char* sampleFlat
Initial value:
=
"1\t1000.0\t1000.0\t0.9\tABC\n"
"2\t2000\t500.0\t0.7\tDEF\n"

Definition at line 36 of file PeptideID_flatTest.cpp.

Referenced by testIStream().

§ sampleMSI

const char* sampleMSI
Initial value:
=
"scan time mz mass intensity charge chargeStates kl background median peaks scanFirst scanLast scanCount\n"
"1 2.248 878.889 1755.7633 61.847733 2 1 0.05977635 0.9152653 1.0536207 5 693 721 1\n"
"1 2.248 752.86017 1503.7076 41.52021 2 1 0.10636939 1.6415321 0.8086928 5 693 715 1\n"
"1 2.248 933.4445 932.4372 33.840942 1 1 0.2521489 5.717129 2.8336976 2 695 707 1\n"
"4 7.116 801.4013 800.3538 18.389582 1 1 0.6249515 1.6089915 1.3883085 3 698 713 1\n"

Definition at line 40 of file PeptideID_flatTest.cpp.

Referenced by testMSInspectIStream().