All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
WaveformOperations_test.cc File Reference

Unit test for waveform operations. More...

#include <boost/test/unit_test.hpp>
#include "icarusalg/Utilities/WaveformOperations.h"

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   WaveformOperationsTest
 

Functions

void NegativePolarityTest ()
 
void PositivePolarityTest ()
 
 BOOST_AUTO_TEST_CASE (AllTests)
 

Detailed Description

Unit test for waveform operations.

Date
June 27, 2019
Author
Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.slac..nosp@m.stan.nosp@m.ford..nosp@m.edu)
See Also
icarusalg/Utilities/WaveformOperations.h

Definition in file WaveformOperations_test.cc.

Macro Definition Documentation

#define BOOST_TEST_MODULE   WaveformOperationsTest

Definition at line 10 of file WaveformOperations_test.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( AllTests  )

Definition at line 128 of file WaveformOperations_test.cc.

128  {
129 
132 
133 } // BOOST_AUTO_TEST_CASE( AllTests )
void NegativePolarityTest()
void PositivePolarityTest()
void NegativePolarityTest ( )

Definition at line 18 of file WaveformOperations_test.cc.

18  {
19 
20  using Sample_t = signed short int;
21 
23 
24  // negative polarity waveform with baseline +8000
25  constexpr NegOp op(+8000);
26 
27  //
28  // "absolute" operations
29  //
30 
31  static_assert(NegOp::distance(+8000, +7000) == +1000);
32  static_assert(NegOp::distance(+8000, +9000) == -1000);
33 
34  static_assert(NegOp::shiftBy(+8000, +1000) == +7000);
35  static_assert(NegOp::shiftBy(+8000, -1000) == +9000);
36 
37  static_assert(NegOp::subtractBaseline(+7000, +8000) == +1000);
38  static_assert(NegOp::subtractBaseline(+9000, +8000) == -1000);
39 
40  //
41  // comparisons
42  //
43 
44  static_assert( (NegOp::lessThan (+8000, +7000)));
45  static_assert(!(NegOp::lessThan (+8000, +8000)));
46  static_assert(!(NegOp::lessThan (+8000, +9000)));
47  static_assert(!(NegOp::greaterThan (+8000, +7000)));
48  static_assert(!(NegOp::greaterThan (+8000, +8000)));
49  static_assert( (NegOp::greaterThan (+8000, +9000)));
50  static_assert(!(NegOp::noLessThan (+8000, +7000)));
51  static_assert( (NegOp::noLessThan (+8000, +8000)));
52  static_assert( (NegOp::noLessThan (+8000, +9000)));
53  static_assert( (NegOp::noGreaterThan(+8000, +7000)));
54  static_assert( (NegOp::noGreaterThan(+8000, +8000)));
55  static_assert(!(NegOp::noGreaterThan(+8000, +9000)));
56 
57  //
58  // operations relative to the baseline
59  //
60 
61  static_assert(op.shiftFromBaseline(+1000) == +7000);
62  static_assert(op.shiftFromBaseline(-1000) == +9000);
63 
64  static_assert(op.subtractBaseline(+7000) == +1000);
65  static_assert(op.subtractBaseline(+9000) == -1000);
66 
67 
68 } // void NegativePolarityTest()
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
Operations< Sample,-1 > NegativePolarityOperations
Waveform operations for negative polarity waveforms.
static constexpr bool noGreaterThan(Sample_t a, Sample_t b)
bool greaterThan(CluLen c1, CluLen c2)
bool lessThan(CluLen c1, CluLen c2)
void PositivePolarityTest ( )

Definition at line 72 of file WaveformOperations_test.cc.

72  {
73 
74  using Sample_t = signed short int;
75 
77 
78  // negative polarity waveform with baseline +8000
79  constexpr PosOp op(+8000);
80 
81  //
82  // "absolute" operations
83  //
84 
85  static_assert(PosOp::distance(+8000, +9000) == +1000);
86  static_assert(PosOp::distance(+8000, +7000) == -1000);
87 
88  static_assert(PosOp::shiftBy(+8000, +1000) == +9000);
89  static_assert(PosOp::shiftBy(+8000, -1000) == +7000);
90 
91  static_assert(PosOp::subtractBaseline(+9000, +8000) == +1000);
92  static_assert(PosOp::subtractBaseline(+7000, +8000) == -1000);
93 
94  //
95  // comparisons
96  //
97 
98  static_assert(!(PosOp::lessThan (+8000, +7000)));
99  static_assert(!(PosOp::lessThan (+8000, +8000)));
100  static_assert( (PosOp::lessThan (+8000, +9000)));
101  static_assert( (PosOp::greaterThan (+8000, +7000)));
102  static_assert(!(PosOp::greaterThan (+8000, +8000)));
103  static_assert(!(PosOp::greaterThan (+8000, +9000)));
104  static_assert( (PosOp::noLessThan (+8000, +7000)));
105  static_assert( (PosOp::noLessThan (+8000, +8000)));
106  static_assert(!(PosOp::noLessThan (+8000, +9000)));
107  static_assert(!(PosOp::noGreaterThan(+8000, +7000)));
108  static_assert( (PosOp::noGreaterThan(+8000, +8000)));
109  static_assert( (PosOp::noGreaterThan(+8000, +9000)));
110 
111  //
112  // operations relative to the baseline
113  //
114 
115  static_assert(op.shiftFromBaseline(+1000) == +9000);
116  static_assert(op.shiftFromBaseline(-1000) == +7000);
117 
118  static_assert(op.subtractBaseline(+9000) == +1000);
119  static_assert(op.subtractBaseline(+7000) == -1000);
120 
121 
122 } // void PositivePolarityTest()
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
static constexpr bool noGreaterThan(Sample_t a, Sample_t b)
bool greaterThan(CluLen c1, CluLen c2)
bool lessThan(CluLen c1, CluLen c2)
Operations< Sample,+1 > PositivePolarityOperations
Waveform operations for positive polarity waveforms.