void HistogramTest::testDefaultConstructor() { Histogram hstg; // ----- // Check // ----- // Ensure that sampling rate is initialized to 1. CPPUNIT_ASSERT_EQUAL( hstg.samplingRate(), 1 ); // Ensure that lower bound is initialized to 0. CPPUNIT_ASSERT_EQUAL( hstg.lowerBnd(), 0 ); // Ensure that upper bound is initialized to 0. CPPUNIT_ASSERT_EQUAL( hstg.upperBnd(), 0 ); }
void HistogramTest::testAssignment() { // An histogram Histogram hstg(_testImg, 0, 255, 5); // A copy of the previous one Histogram hcpy = hstg; // Ensure that both histograms are quite similar // sampling rate CPPUNIT_ASSERT_EQUAL( hstg.samplingRate(), hcpy.samplingRate() ); // lower bound CPPUNIT_ASSERT_EQUAL( hstg.lowerBnd(), hcpy.lowerBnd() ); // upper bound CPPUNIT_ASSERT_EQUAL( hstg.upperBnd(), hcpy.upperBnd() ); // frequencies for (int idx = hstg.lowerBnd() ; idx <= hstg.upperBnd() ; idx++) { CPPUNIT_ASSERT_EQUAL( hstg[idx], hcpy[idx] ); } }