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}
const TestData testData[]
ostream * os_
const double testArray[]
static std::vector< T > smooth_copy(const std::vector< T > &data)
#define unit_assert(x)
Definition unit.hpp:85

References os_, pwiz::analysis::SavitzkyGolaySmoother< T >::smooth_copy(), 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}
#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, 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.

36{
37 1, 15, 29, 20, 10, 40, 1, 50, 3, 40, 3, 25, 23, 90,
38 1, 15, 29, 20, 10, 40, 1, 50, 3, 40, 3, 25, 23, 90,
39 1, 15, 29, 20, 10, 40, 1, 50, 3, 40, 3, 25, 23, 90,
40 1, 15, 29, 20, 10, 40, 1, 50, 3, 40, 3, 25, 23, 90
41};

Referenced by test().