9 #include <boost/test/unit_test.hpp>
23 Thing(GeometryID i,
double v) : id(i),
value(v) {}
25 constexpr
auto geometryId()
const {
return id; }
31 GeometryID makeId(
int volume,
int layer = 0,
int sensitive = 0) {
32 return GeometryID().setVolume(volume).setLayer(
layer).setSensitive(sensitive);
37 BOOST_TEST_DONT_PRINT_LOG_VALUE(Container::Iterator)
39 BOOST_AUTO_TEST_SUITE(HierarchicalGeometryContainer)
43 BOOST_TEST(c.begin() == c.end());
44 BOOST_TEST(c.empty());
45 BOOST_TEST(c.size() == 0
u);
50 {makeId(2, 4, 6), 1.0},
54 {makeId(2, 4, 6), 2.0},
56 BOOST_CHECK_THROW(Container(std::move(elements)), std::invalid_argument);
62 {makeId(2, 4, 6), -23.0},
69 {makeId(12, 16), -1.0},
73 BOOST_TEST(std::next(
c.begin(), 4
u) ==
c.end());
74 BOOST_TEST(not
c.empty());
75 BOOST_TEST(
c.size() == 4
u);
79 auto ret =
c.find(makeId(2, 4, 6));
80 BOOST_TEST(ret !=
c.end());
81 BOOST_TEST(ret->id == makeId(2, 4, 6));
85 auto ret =
c.find(makeId(2, 4, 7));
86 BOOST_TEST(ret !=
c.end());
87 BOOST_TEST(ret->id == makeId(2));
91 auto ret =
c.find(makeId(2, 13));
92 BOOST_TEST(ret !=
c.end());
93 BOOST_TEST(ret->id == makeId(2));
97 auto ret =
c.find(makeId(2, 8, 13));
98 BOOST_TEST(ret !=
c.end());
99 BOOST_TEST(ret->id == makeId(2, 8));
103 auto ret =
c.find(makeId(2, 8));
104 BOOST_TEST(ret !=
c.end());
105 BOOST_TEST(ret->id == makeId(2, 8));
109 auto ret =
c.find(makeId(2));
110 BOOST_TEST(ret !=
c.end());
111 BOOST_TEST(ret->id == makeId(2));
116 auto ret =
c.find(makeId(12, 16, 20));
117 BOOST_TEST(ret !=
c.end());
118 BOOST_TEST(ret->id == makeId(12, 16));
122 auto ret =
c.find(makeId(12, 16));
123 BOOST_TEST(ret !=
c.end());
124 BOOST_TEST(ret->id == makeId(12, 16));
127 BOOST_TEST(
c.find(makeId(12)) ==
c.end());
130 BOOST_TEST(
c.find(makeId(3, 5, 7)) ==
c.end());
132 BOOST_TEST(
c.find(makeId(3, 5)) ==
c.end());
134 BOOST_TEST(
c.find(makeId(3)) ==
c.end());
137 BOOST_AUTO_TEST_SUITE_END()