4 #include <boost/test/unit_test.hpp> 16 std::vector<int> cuts;
32 std::vector<int> cuts{0, 10, 20, 30, 40, 50, 60, 70, 80, 90,
33 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000};
36 BOOST_CHECK_EQUAL(bin.histogram_min(), 0);
37 BOOST_CHECK_EQUAL(bin.histogram_max(), 1000);
38 BOOST_CHECK_EQUAL(bin.theoretical_min(), std::numeric_limits<int>::min());
39 BOOST_CHECK_EQUAL(bin.theoretical_max(), std::numeric_limits<int>::max());
40 BOOST_CHECK_EQUAL(bin.sample2bin(0), 0);
41 BOOST_CHECK_EQUAL(bin.sample2bin(5), 0);
42 BOOST_CHECK_EQUAL(bin.sample2bin(25), 2);
43 BOOST_CHECK_EQUAL(bin.sample2bin(90), 9);
44 BOOST_CHECK_EQUAL(bin.sample2bin(99), 9);
45 BOOST_CHECK_EQUAL(bin.sample2bin(100), 10);
46 BOOST_CHECK_EQUAL(bin.sample2bin(120), 10);
47 BOOST_CHECK_EQUAL(bin.sample2bin(193), 10);
48 BOOST_CHECK_EQUAL(bin.sample2bin(400), 13);
49 BOOST_CHECK_EQUAL(bin.sample2bin(999), 18);
50 BOOST_CHECK_EQUAL(bin.bin2sample(0), 0);
51 BOOST_CHECK_EQUAL(bin.bin2sample(1), 10);
52 BOOST_CHECK_EQUAL(bin.bin2sample(10), 100);
53 BOOST_CHECK_EQUAL(bin.bin2sample(11), 200);
54 BOOST_CHECK_EQUAL(bin.bin2sample(14), 500);
62 tested_histogram::binning_strategy{10, 20, 30, 40, 50, 100, 150, 200});
63 BOOST_CHECK_THROW(h.estimated_mean(), std::invalid_argument);
71 BOOST_CHECK_EQUAL(h.estimated_mean(), 25);
79 double eps = (1 << 8) * std::numeric_limits<double>::epsilon();
80 BOOST_CHECK_CLOSE(h.estimated_quantile(0.00), 0.00, eps);
81 BOOST_CHECK_CLOSE(h.estimated_quantile(0.10), 10.00, eps);
82 BOOST_CHECK_CLOSE(h.estimated_quantile(0.20), 20.00, eps);
83 BOOST_CHECK_CLOSE(h.estimated_quantile(0.30), 29.00, eps);
84 BOOST_CHECK_CLOSE(h.estimated_quantile(0.40), 40.00, eps);
85 BOOST_CHECK_CLOSE(h.estimated_quantile(0.50), 43.00, eps);
86 BOOST_CHECK_CLOSE(h.estimated_quantile(0.60), 46.00, eps);
87 BOOST_CHECK_CLOSE(h.estimated_quantile(0.70), 50.00, eps);
88 BOOST_CHECK_CLOSE(h.estimated_quantile(0.80), 150.00, eps);
89 BOOST_CHECK_CLOSE(h.estimated_quantile(1.00), 1000.00, eps);
A histogram class with controllable binning and range strategy.
A histogram binning_strategy for integer numbers with user defined cuts.
BOOST_AUTO_TEST_CASE(explicit_cuts_binning_constructor)