ProteoWizard
Functions | Variables
SavitzkyGolaySmootherTest.cpp File Reference
#include "SavitzkyGolaySmoother.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
 
const double testArray []
 

Function Documentation

◆ test()

void test ( )

Definition at line 44 of file SavitzkyGolaySmootherTest.cpp.

45 {
46  vector<double> testData(testArray, testArray+(14*4));
47  if (os_)
48  {
49  *os_ << "Unsmoothed data (" << testData.size() << "):\t";
50  copy(testData.begin(), testData.end(), ostream_iterator<double>(*os_, "\t"));
51  *os_ << endl;
52  }
53 
54  vector<double> smoothData = SavitzkyGolaySmoother<double>::smooth_copy(testData);
55 
56  if (os_)
57  {
58  *os_ << "Smoothed data (" << smoothData.size() << "):\t";
59  copy(smoothData.begin(), smoothData.end(), ostream_iterator<double>(*os_, "\t"));
60  *os_ << endl;
61  }
62 
63  unit_assert(smoothData.size() == testData.size());
64 }

References os_, testArray, testData, and unit_assert.

Referenced by main().

◆ main()

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

Definition at line 67 of file SavitzkyGolaySmootherTest.cpp.

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 }

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

Variable Documentation

◆ os_

ostream* os_ = 0

Definition at line 32 of file SavitzkyGolaySmootherTest.cpp.

Referenced by main(), and test().

◆ testArray

const double testArray[]
Initial value:
=
{
1, 15, 29, 20, 10, 40, 1, 50, 3, 40, 3, 25, 23, 90,
1, 15, 29, 20, 10, 40, 1, 50, 3, 40, 3, 25, 23, 90,
1, 15, 29, 20, 10, 40, 1, 50, 3, 40, 3, 25, 23, 90,
1, 15, 29, 20, 10, 40, 1, 50, 3, 40, 3, 25, 23, 90
}

Definition at line 35 of file SavitzkyGolaySmootherTest.cpp.

Referenced by test().

os_
ostream * os_
Definition: SavitzkyGolaySmootherTest.cpp:32
TEST_EPILOG
#define TEST_EPILOG
Definition: unit.hpp:183
pwiz::analysis::SavitzkyGolaySmoother
Definition: SavitzkyGolaySmoother.hpp:38
testArray
const double testArray[]
Definition: SavitzkyGolaySmootherTest.cpp:35
testData
const TestData testData[]
Definition: SavitzkyGolaySmootherTest.cpp:44
TEST_FAILED
#define TEST_FAILED(x)
Definition: unit.hpp:177
TEST_PROLOG
#define TEST_PROLOG(argc, argv)
Definition: unit.hpp:175
unit_assert
#define unit_assert(x)
Definition: unit.hpp:85
test
void test()
Definition: SavitzkyGolaySmootherTest.cpp:44