25 #ifndef WHISTOGRAM2D_TEST_H
26 #define WHISTOGRAM2D_TEST_H
28 #include <cxxtest/TestSuite.h>
30 #include "../WHistogram2D.h"
31 #include "../WLimits.h"
32 #include "../WLogger.h"
54 TS_ASSERT_EQUALS( h.
size(), 100 );
63 TS_ASSERT_EQUALS( h.
size(), 9 );
64 for(
size_t i = 0; i < 3; ++i )
66 for(
size_t j = 0; j < 3; ++j )
68 TS_ASSERT_EQUALS( h( i, j ), 0 );
80 for(
size_t i = 0; i < 3; ++i )
82 for(
size_t j = 0; j < 3; ++j )
84 TS_ASSERT_EQUALS( h( i, j ), 1 );
95 h.
insert( 0.0999999, 0.0 );
96 TS_ASSERT_EQUALS( h( 0, 0 ), 1 );
98 TS_ASSERT_EQUALS( h( 1, 0 ), 1 );
100 TS_ASSERT_EQUALS( h( 1, 0 ), 2 );
101 h.
insert( 0.39999, 0.39999 );
102 TS_ASSERT_EQUALS( h( 3, 3 ), 1 );
112 TS_ASSERT_EQUALS( h( 0, 0 ), 1 );
113 TS_ASSERT_EQUALS( h( 1, 0 ), 0 );
114 TS_ASSERT_EQUALS( h( 0, 1 ), 0 );
115 TS_ASSERT_EQUALS( h( 1, 1 ), 0 );
125 TS_ASSERT_EQUALS( h( 0, 0 ), 0 );
126 TS_ASSERT_EQUALS( h( 1, 0 ), 0 );
127 TS_ASSERT_EQUALS( h( 0, 1 ), 0 );
128 TS_ASSERT_EQUALS( h( 1, 1 ), 1 );
139 for(
size_t i = 0; i < 10; ++i )
141 for(
size_t j = 0; j < 10; ++j )
143 TS_ASSERT_EQUALS( h( i, j ), 0 );
153 double max = 10000.000000010001;
154 WHistogram2D h( -2147483646, max, -2147483646, max, 2, 2 );
157 TS_ASSERT_EQUALS( h( 1, 1 ), 2 );
161 #endif // WHISTOGRAM2D_TEST_H
virtual size_t size() const
Returns the number of buckets in the HistogramND with the actual mapping.
void testInsert(void)
Check normal insertion inside the min max boundaries.
Uniform two dimensional histogram for double values.
void testInsertOnIntervalBorder(void)
If the value is directly on the borderline it counts to the right interval.
void testInsertMin(void)
If the minimum is inserted the first bin should be incremented.
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.
void testInitialization(void)
Check when nothing was inserted every thing is empty.
const double DBL_EPS
Smallest double such: 1.0 + DBL_EPS == 1.0 is still true.
void insert(TArray values)
Given a value the corresponding bucket is determined and incremented by one.
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 testInsertAlmostMax(void)
Also for values near the maxium.
void testInsertMax(void)
If the maximum is inserted the right most interval is used.
void setUp()
Setup logger and other stuff for each test.