1414#include < boost/histogram/axis/category.hpp>
1515#include < boost/histogram/axis/integer.hpp>
1616#include < boost/histogram/axis/ostream.hpp>
17+ #include < boost/histogram/axis/regular.hpp>
18+ #include < boost/histogram/axis/variant.hpp>
1719#include < boost/histogram/histogram.hpp>
1820#include < boost/histogram/literals.hpp>
1921#include < boost/histogram/make_histogram.hpp>
@@ -343,6 +345,61 @@ void run_tests(const std::vector<int>& x, const std::vector<int>& y,
343345 }
344346}
345347
348+ void special_tests () {
349+ // 1D growing (bug?)
350+ {
351+ using axis_type_1 =
352+ axis::regular<double , use_default, use_default, axis::option::bitset<11u >>;
353+ using axis_type_2 = axis::regular<double >;
354+ using axis_type_3 = axis::integer<int >;
355+ using axis_type_4 = axis::category<int >;
356+ using axis_type_5 = axis::category<std::string>;
357+
358+ using axis_variant_type =
359+ axis::variant<axis_type_1, axis_type_2, axis_type_3, axis_type_4, axis_type_5>;
360+
361+ auto axes = std::vector<axis_variant_type>({axis_type_1 (10 , 0 , 1 )});
362+ auto h = histogram<decltype (axes), dense_storage<double >>(axes);
363+ auto h2 = h;
364+
365+ std::vector<int > f1 ({2 });
366+ std::vector<int > f2 ({-1 });
367+
368+ h (2 );
369+ h (-1 );
370+
371+ h2.fill (f1);
372+ h2.fill (f2);
373+
374+ BOOST_TEST_EQ (h, h2);
375+ BOOST_TEST_EQ (sum (h2), 2 );
376+ }
377+
378+ // 1D growing (bug?)
379+ {
380+ using axis_type_1 =
381+ axis::regular<double , use_default, use_default, axis::option::bitset<11u >>;
382+
383+ using axis_variant_type = axis::variant<axis_type_1>;
384+
385+ auto axes = std::vector<axis_variant_type>({axis_type_1 (10 , 0 , 1 )});
386+ auto h = histogram<decltype (axes), dense_storage<double >>(axes);
387+ auto h2 = h;
388+
389+ std::vector<int > f1 ({2 });
390+ std::vector<int > f2 ({-1 });
391+
392+ h (2 );
393+ h (-1 );
394+
395+ h2.fill (f1);
396+ h2.fill (f2);
397+
398+ BOOST_TEST_EQ (h, h2);
399+ BOOST_TEST_EQ (sum (h2), 2 );
400+ }
401+ }
402+
346403int main () {
347404 std::mt19937 gen (1 );
348405 std::normal_distribution<> id (0 , 2 );
@@ -357,5 +414,7 @@ int main() {
357414 run_tests<static_tag>(x, y, w);
358415 run_tests<dynamic_tag>(x, y, w);
359416
417+ special_tests ();
418+
360419 return boost::report_errors ();
361420}
0 commit comments