ProteoWizard
Functions | Variables
IsotopeEnvelopeEstimatorTest.cpp File Reference
#include "IsotopeEnvelopeEstimator.hpp"
#include "IsotopeCalculator.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "pwiz/utility/misc/Std.hpp"
#include <cstring>

Go to the source code of this file.

Functions

void testInstantiationWithNull ()
 
void test ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_ = 0
 

Function Documentation

◆ testInstantiationWithNull()

void testInstantiationWithNull ( )

Definition at line 38 of file IsotopeEnvelopeEstimatorTest.cpp.

39{
40 try
41 {
43 IsotopeEnvelopeEstimator estimator(config);
44 }
45 catch (...)
46 {
47 if (os_) *os_ << "Null IsotopeCalculator* check ok.\n";
48 return;
49 }
50
51 throw runtime_error("Failed to check for null IsotopeCalculator*.");
52}
Class used for calculating a theoretical isotope envelope for a given mass, based on an estimate of t...

References os_.

Referenced by main().

◆ test()

void test ( )

Definition at line 55 of file IsotopeEnvelopeEstimatorTest.cpp.

56{
57 const double abundanceCutoff = .01;
58 const double massPrecision = .1;
59 IsotopeCalculator isotopeCalculator(abundanceCutoff, massPrecision);
60
62 config.isotopeCalculator = &isotopeCalculator;
63
64 IsotopeEnvelopeEstimator estimator(config);
65
66 if (os_)
67 for (int mass=100; mass<=3000; mass+=100)
68 *os_ << mass << ":\n" << estimator.isotopeEnvelope(mass) << endl;
69
70 // TODO: external verification of these estimates
71}

References pwiz::chemistry::IsotopeEnvelopeEstimator::Config::isotopeCalculator, pwiz::chemistry::IsotopeEnvelopeEstimator::isotopeEnvelope(), and os_.

Referenced by main().

◆ main()

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

Definition at line 74 of file IsotopeEnvelopeEstimatorTest.cpp.

75{
76 TEST_PROLOG(argc, argv)
77
78 try
79 {
80 if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
81 if (os_) *os_ << "IsotopeEnvelopeEstimatorTest\n";
83 test();
84 }
85 catch (exception& e)
86 {
87 TEST_FAILED(e.what())
88 }
89 catch (...)
90 {
91 TEST_FAILED("Caught unknown exception.")
92 }
93
95}
void testInstantiationWithNull()
#define TEST_EPILOG
Definition unit.hpp:183
#define TEST_FAILED(x)
Definition unit.hpp:177
#define TEST_PROLOG(argc, argv)
Definition unit.hpp:175

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

Variable Documentation

◆ os_

ostream* os_ = 0

Definition at line 35 of file IsotopeEnvelopeEstimatorTest.cpp.

Referenced by main(), test(), and testInstantiationWithNull().