25 #ifndef WHISTOGRAMBASIC_TEST_H
26 #define WHISTOGRAMBASIC_TEST_H
28 #include <cxxtest/TestSuite.h>
30 #include "../WHistogramBasic.h"
31 #include "../WLimits.h"
32 #include "../WLogger.h"
54 TS_ASSERT_EQUALS( h.
size(), 1000 );
65 TS_ASSERT_EQUALS( h.
size(), 1000 );
67 TS_ASSERT_EQUALS( h[723], 1 );
77 TS_ASSERT_EQUALS( h[1], 1 );
79 TS_ASSERT_EQUALS( h[3], 1 );
81 TS_ASSERT_EQUALS( h[7], 1 );
91 TS_ASSERT_EQUALS( h[0], 1 );
92 TS_ASSERT_EQUALS( h[1], 0 );
103 TS_ASSERT_EQUALS( h[999], 1 );
104 TS_ASSERT_EQUALS( h[0], 1 );
115 for(
size_t i = 0; i < h.
size(); ++i )
117 TS_ASSERT_EQUALS( h[i], 0 );
127 for(
size_t i = 0; i < h.
size(); ++i )
129 TS_ASSERT_EQUALS( h[i], 0 );
141 double max = 10000.000000010001;
145 TS_ASSERT_EQUALS( h[999], 2 );
Unit tests the WHistogramBasic class.
void testInsertOutOfBounds(void)
If above the maximum values are inserted a warning should be printed and nothing should happen.
void testOperatorToGetNumberOfElementsInsideTheBin(void)
For each insert this number should increase by one.
void testInsertMin(void)
If the minimum is inserted the first bin should be incremented.
void testInsertAlmostMax(void)
Also for values near the maxium.
void testInsertMax(void)
If the maximum is inserted the right most interval is used.
void testInsertOnIntervalBorder(void)
If the value is directly on the borderline it counts to the right interval.
void testInitialization(void)
Check when nothing was inserted every thing is empty.
void setUp()
Setup logger and other stuff for each test.
void testInsert(void)
Check normal insertion inside the min max boundaries.
Container which associate values with (uniform width) bins (aka intervals or buckets).
virtual std::size_t insert(double value)
Inserts a given value within the given range (min, max) into exactly one bin and increment its size.
std::size_t valuesSize() const
Computes the number of inserted values so far.
virtual std::size_t size() const
Returns the number of buckets in the histogram with the actual mapping.
static void startup(std::ostream &output=std::cout, LogLevel level=LL_DEBUG)
Create the first and only instance of the logger as it is a singleton.
const float FLT_EPS
Smallest float such: 1.0 + FLT_EPS == 1.0 is still true.
const double DBL_EPS
Smallest double such: 1.0 + DBL_EPS == 1.0 is still true.