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