9 #include <boost/test/unit_test.hpp>
36 #define CHECK_ENTRY(container, query, compare) \
38 auto ret = container.find(query); \
39 BOOST_CHECK_NE(ret, container.end()); \
40 if (ret != container.end()) { \
41 auto idx = std::distance(container.begin(), ret); \
42 BOOST_CHECK_EQUAL(container.idAt(idx), compare); \
46 BOOST_TEST_DONT_PRINT_LOG_VALUE(Container::Iterator)
47 BOOST_TEST_DONT_PRINT_LOG_VALUE(Thing)
49 BOOST_AUTO_TEST_SUITE(GeometryHierarchyMap)
53 BOOST_CHECK_EQUAL(c.begin(), c.end());
54 BOOST_CHECK(c.empty());
55 BOOST_CHECK_EQUAL(c.size(), 0
u);
59 std::vector<std::pair<GeometryIdentifier, Thing>> entries = {
66 BOOST_CHECK_THROW(Container(std::move(entries)), std::invalid_argument);
68 std::vector<std::pair<GeometryIdentifier, Thing>> defaults = {
73 BOOST_CHECK_THROW(Container(std::move(defaults)), std::invalid_argument);
83 BOOST_CHECK_EQUAL(std::next(c.begin(), 4), c.end());
84 BOOST_CHECK(not c.empty());
85 BOOST_CHECK_EQUAL(c.size(), 4
u);
100 BOOST_CHECK(not
c.empty());
101 BOOST_CHECK_EQUAL(
c.size(), 4
u);
104 for (
auto i =
c.size(); 0 < i--;) {
106 BOOST_CHECK_NE(
c.idAt(i), GeometryIdentifier());
108 BOOST_CHECK_NE(
c.valueAt(i).value, Thing().value);
111 BOOST_CHECK_THROW(
c.idAt(
c.size()), std::out_of_range);
112 BOOST_CHECK_THROW(
c.valueAt(
c.size()), std::out_of_range);
118 {
makeId(2, 4, 6), {-23.0}},
129 BOOST_CHECK_EQUAL(std::next(c.begin(), 4
u), c.end());
130 BOOST_CHECK(not c.empty());
131 BOOST_CHECK_EQUAL(c.size(), 4
u);
152 BOOST_CHECK_EQUAL(c.find(
makeId(3, 5, 7)), c.end());
154 BOOST_CHECK_EQUAL(c.find(
makeId(3, 5)), c.end());
156 BOOST_CHECK_EQUAL(c.find(
makeId(3)), c.end());
158 BOOST_CHECK_EQUAL(c.find(
makeId(12)), c.end());
172 BOOST_CHECK_EQUAL(std::next(c.begin(), 3
u), c.end());
173 BOOST_CHECK(not c.empty());
174 BOOST_CHECK_EQUAL(c.size(), 3
u);
194 BOOST_AUTO_TEST_SUITE_END()