PAASS
Software suite to Acquire and Analyze Data from Pixie16
unittest-PolynomialCfd.cpp
Go to the documentation of this file.
1 #include <iostream>
5 #include <stdexcept>
6 #include <utility>
7 #include <vector>
8 
9 #include <UnitTest++.h>
10 
11 #include "PolynomialCfd.hpp"
12 #include "UnitTestSampleData.hpp"
13 
14 using namespace std;
15 using namespace unittest_trace_variables;
16 using namespace unittest_cfd_variables;
17 
18 
19 TEST_FIXTURE(PolynomialCfd, TestPolynomialCfd) {
20  //Checking that we throw a range_error when the data vector is zero
21  CHECK_THROW(CalculatePhase(empty_vector_double, cfd_test_pars, max_pair,
22  baseline_pair), range_error);
23 
24  //Check that we throw a range error when the max position is larger than
25  // the data we provided.
26  CHECK_THROW(CalculatePhase(trace_sans_baseline, cfd_test_pars,
27  make_pair(trace_sans_baseline.size()+3, 100),
28  baseline_pair), range_error);
29 
30  //The expected value in this case is the value that I obtained after
31  // debugging the algorithm using other means. This check is here simply
32  // to tell us whether or not the algorithm has changed drastically from
33  // the "acceptable" value.
34  CHECK_CLOSE(73.9898,
35  CalculatePhase(trace_sans_baseline, cfd_test_pars,
37  5);
38 }
39 
40 int main(int argv, char *argc[]) {
41  return (UnitTest::RunAllTests());
42 }
static const std::pair< unsigned int, double > extrapolated_maximum_pair(max_position, extrapolated_maximum)
STL namespace.
static const std::pair< unsigned int, double > max_pair(max_position, maximum_value)
This is the pair made from the expected maximum information.
static const std::pair< double, double > baseline_pair(baseline, standard_deviation)
A method that uses the.
This header provides sample data that can be used by Unit Tests to ensure proper functionality.
static const std::pair< double, double > cfd_test_pars(0.5, 2.)
static const std::vector< double > empty_vector_double
static const std::vector< double > trace_sans_baseline
TEST_FIXTURE(PolynomialCfd, TestPolynomialCfd)
int main(int argv, char *argc[])