diff --git a/test/histogram_fill_test.cpp b/test/histogram_fill_test.cpp index b4672c35..c49cab25 100644 --- a/test/histogram_fill_test.cpp +++ b/test/histogram_fill_test.cpp @@ -345,61 +345,6 @@ void run_tests(const std::vector& x, const std::vector& y, } } -void special_tests() { - // 1D growing (bug?) - { - using axis_type_1 = - axis::regular>; - using axis_type_2 = axis::regular; - using axis_type_3 = axis::integer; - using axis_type_4 = axis::category; - using axis_type_5 = axis::category; - - using axis_variant_type = - axis::variant; - - auto axes = std::vector({axis_type_1(10, 0, 1)}); - auto h = histogram>(axes); - auto h2 = h; - - std::vector f1({2}); - std::vector f2({-1}); - - h(2); - h(-1); - - h2.fill(f1); - h2.fill(f2); - - BOOST_TEST_EQ(h, h2); - BOOST_TEST_EQ(sum(h2), 2); - } - - // 1D growing (bug?) - { - using axis_type_1 = - axis::regular>; - - using axis_variant_type = axis::variant; - - auto axes = std::vector({axis_type_1(10, 0, 1)}); - auto h = histogram>(axes); - auto h2 = h; - - std::vector f1({2}); - std::vector f2({-1}); - - h(2); - h(-1); - - h2.fill(f1); - h2.fill(f2); - - BOOST_TEST_EQ(h, h2); - BOOST_TEST_EQ(sum(h2), 2); - } -} - int main() { std::mt19937 gen(1); std::normal_distribution<> id(0, 2); @@ -414,7 +359,5 @@ int main() { run_tests(x, y, w); run_tests(x, y, w); - special_tests(); - return boost::report_errors(); } diff --git a/test/issue_327_test.cpp b/test/issue_327_test.cpp index 6fda0c52..b3fc7c6d 100644 --- a/test/issue_327_test.cpp +++ b/test/issue_327_test.cpp @@ -19,14 +19,40 @@ using arg_t = boost::variant2::variant, int>; int main() { using axis_type = bh::axis::regular; - using axis_variant = bh::axis::variant; + using axis_variant_type = bh::axis::variant; - auto axes = std::vector({axis_type(10, 0, 1)}); - auto h = bh::make_histogram_with(std::vector(), axes); - BOOST_TEST_EQ(h.rank(), 1); + // 1D growing A + { + auto axes = std::vector({axis_type(10, 0, 1)}); + auto h = bh::make_histogram_with(bh::dense_storage(), axes); + auto h2 = h; - std::vector vargs = {-1}; - h.fill(vargs); // CRASH, using h.fill(-1) or h.fill(args) does not crash. + h(-1); + + // used to crash, while growing B did not crash + std::vector vargs = {-1}; + h2.fill(vargs); + + BOOST_TEST_EQ(h, h2); + } + + // 1D growing B + { + auto axes = std::vector({axis_type(10, 0, 1)}); + auto h = bh::make_histogram_with(bh::dense_storage(), axes); + auto h2 = h; + + h(2); + h(-1); + + std::vector f1({2}); + std::vector f2({-1}); + + h2.fill(f1); + h2.fill(f2); + + BOOST_TEST_EQ(h, h2); + } return boost::report_errors(); }