Skip to content

Commit 26e708e

Browse files
committed
clean up
1 parent 2ed4cae commit 26e708e

File tree

2 files changed

+32
-63
lines changed

2 files changed

+32
-63
lines changed

test/histogram_fill_test.cpp

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -345,61 +345,6 @@ void run_tests(const std::vector<int>& x, const std::vector<int>& y,
345345
}
346346
}
347347

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-
403348
int main() {
404349
std::mt19937 gen(1);
405350
std::normal_distribution<> id(0, 2);
@@ -414,7 +359,5 @@ int main() {
414359
run_tests<static_tag>(x, y, w);
415360
run_tests<dynamic_tag>(x, y, w);
416361

417-
special_tests();
418-
419362
return boost::report_errors();
420363
}

test/issue_327_test.cpp

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,40 @@ using arg_t = boost::variant2::variant<std::vector<int>, int>;
1919
int main() {
2020
using axis_type =
2121
bh::axis::regular<double, bh::use_default, bh::use_default, uogrowth_t>;
22-
using axis_variant = bh::axis::variant<axis_type>;
22+
using axis_variant_type = bh::axis::variant<axis_type>;
2323

24-
auto axes = std::vector<axis_variant>({axis_type(10, 0, 1)});
25-
auto h = bh::make_histogram_with(std::vector<int>(), axes);
26-
BOOST_TEST_EQ(h.rank(), 1);
24+
// 1D growing A
25+
{
26+
auto axes = std::vector<axis_variant_type>({axis_type(10, 0, 1)});
27+
auto h = bh::make_histogram_with(bh::dense_storage<double>(), axes);
28+
auto h2 = h;
2729

28-
std::vector<arg_t> vargs = {-1};
29-
h.fill(vargs); // CRASH, using h.fill(-1) or h.fill(args) does not crash.
30+
h(-1);
31+
32+
// used to crash, while growing B did not crash
33+
std::vector<arg_t> vargs = {-1};
34+
h2.fill(vargs);
35+
36+
BOOST_TEST_EQ(h, h2);
37+
}
38+
39+
// 1D growing B
40+
{
41+
auto axes = std::vector<axis_variant_type>({axis_type(10, 0, 1)});
42+
auto h = bh::make_histogram_with(bh::dense_storage<double>(), axes);
43+
auto h2 = h;
44+
45+
h(2);
46+
h(-1);
47+
48+
std::vector<int> f1({2});
49+
std::vector<int> f2({-1});
50+
51+
h2.fill(f1);
52+
h2.fill(f2);
53+
54+
BOOST_TEST_EQ(h, h2);
55+
}
3056

3157
return boost::report_errors();
3258
}

0 commit comments

Comments
 (0)