ProteoWizard
Functions | Variables
PeakFamilyDetectorFTTest.cpp File Reference
#include "PeakFamilyDetectorFT.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "pwiz/utility/misc/Std.hpp"

Go to the source code of this file.

Functions

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

Variables

ostream * os_ = 0
 
double peakFamilyDetectorFTTestData_ []
 
int peakFamilyDetectorFTTestDataSize_
 

Function Documentation

§ test()

void test ( )

Definition at line 43 of file PeakFamilyDetectorFTTest.cpp.

References pwiz::analysis::PeakFamilyDetectorFT::Config::cp, pwiz::analysis::PeakFamilyDetectorFT::detect(), pwiz::analysis::PeakFamilyDetectorFT::Config::log, os_, peakFamilyDetectorFTTestData_, peakFamilyDetectorFTTestDataSize_, unit_assert, and unit_assert_equal.

Referenced by main().

44 {
45  // instantiate PeakFamilyDetectorFT
46 
48  config.log = os_;
49  config.cp = CalibrationParameters::thermo_FT();
50  PeakFamilyDetectorFT detector(config);
51 
52  // detect
53 
54  vector<PeakFamily> result;
55  const MZIntensityPair* begin =
56  reinterpret_cast<const MZIntensityPair*>(&peakFamilyDetectorFTTestData_[0]);
58 
59  detector.detect(begin, end, result);
60 
61  if (os_)
62  {
63  *os_ << setprecision(10) << "result: " << result.size() << endl;
64  copy(result.begin(), result.end(), ostream_iterator<PeakFamily>(*os_, "\n"));
65  }
66 
67  unit_assert(result.size() == 1);
68  unit_assert_equal(result[0].mzMonoisotopic, 810.4148, .005);
69 }
double peakFamilyDetectorFTTestData_[]
#define unit_assert_equal(x, y, epsilon)
Definition: unit.hpp:99
FT-specific implementation of PeakFamilyDetector.
The data point type of a mass spectrum.
Definition: MSData.hpp:421
ostream * os_
int peakFamilyDetectorFTTestDataSize_
#define unit_assert(x)
Definition: unit.hpp:85

§ main()

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

Definition at line 72 of file PeakFamilyDetectorFTTest.cpp.

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

73 {
74  TEST_PROLOG(argc, argv)
75 
76  try
77  {
78  if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
79  if (os_) *os_ << "PeakFamilyDetectorFTTest\n";
80  test();
81  }
82  catch (exception& e)
83  {
84  TEST_FAILED(e.what())
85  }
86  catch (...)
87  {
88  TEST_FAILED("Caught unknown exception.")
89  }
90 
92 }
#define TEST_EPILOG
Definition: unit.hpp:182
ostream * os_
#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 36 of file PeakFamilyDetectorFTTest.cpp.

Referenced by main(), and test().

§ peakFamilyDetectorFTTestData_

double peakFamilyDetectorFTTestData_[]

Referenced by test().

§ peakFamilyDetectorFTTestDataSize_

int peakFamilyDetectorFTTestDataSize_

Referenced by test().