9 #include <boost/test/unit_test.hpp>
14 #include <type_traits>
15 #include <unordered_set>
17 #include <boost/mpl/list.hpp>
23 using Indices = boost::mpl::list<Index32, Index64>;
28 BOOST_CHECK(std::is_standard_layout_v<T>);
29 BOOST_CHECK(std::is_trivially_default_constructible_v<T>);
30 BOOST_CHECK(std::is_trivially_copy_constructible_v<T>);
31 BOOST_CHECK(std::is_trivially_move_constructible_v<T>);
32 BOOST_CHECK((std::is_trivially_assignable_v<T, T>));
33 BOOST_CHECK((std::is_trivially_copy_assignable_v<T>));
34 BOOST_CHECK((std::is_trivially_move_assignable_v<T>));
41 BOOST_CHECK_EQUAL(idx.
value(), 0xabcd2400
u);
42 BOOST_CHECK_EQUAL(idx.
level(0), 0xabcd
u);
43 BOOST_CHECK_EQUAL(idx.
level(1), 0x24
u);
44 BOOST_CHECK_EQUAL(idx.
level(2), 0x00
u);
49 BOOST_CHECK_EQUAL(idx.
value(), 0xabcd2400
u);
50 BOOST_CHECK_EQUAL(idx.
level(0), 0xabcd
u);
51 BOOST_CHECK_EQUAL(idx.
level(1), 0x24
u);
52 BOOST_CHECK_EQUAL(idx.
level(2), 0x00
u);
60 BOOST_CHECK_EQUAL(idx.
value(), 0x00180000
u);
61 BOOST_CHECK_EQUAL(idx.
level(0), 24
u);
62 BOOST_CHECK_EQUAL(idx.
level(1), 0
u);
63 BOOST_CHECK_EQUAL(idx.
level(2), 0
u);
66 BOOST_CHECK_EQUAL(idx.
value(), 0x001800ff
u);
67 BOOST_CHECK_EQUAL(idx.
level(0), 24
u);
68 BOOST_CHECK_EQUAL(idx.
level(1), 0
u);
69 BOOST_CHECK_EQUAL(idx.
level(2), 255
u);
81 for (
auto maxValue : maxValues) {
98 for (
auto maxValue : maxValues) {
108 BOOST_CHECK_EQUAL(idx3.level(0), 13
u);
109 BOOST_CHECK_EQUAL(idx3.level(1), 14
u);
110 BOOST_CHECK_EQUAL(idx3.level(2), 15
u);
113 BOOST_CHECK_EQUAL(idx2.level(0), 13
u);
114 BOOST_CHECK_EQUAL(idx2.level(1), 14
u);
115 BOOST_CHECK_EQUAL(idx2.level(2), 0
u);
118 BOOST_CHECK_EQUAL(idx1.level(0), 13
u);
119 BOOST_CHECK_EQUAL(idx1.level(1), 0
u);
120 BOOST_CHECK_EQUAL(idx1.level(2), 0
u);
124 BOOST_CHECK_EQUAL(idx0.value(), 0
u);
125 BOOST_CHECK_EQUAL(idx0.level(0), 0
u);
126 BOOST_CHECK_EQUAL(idx0.level(1), 0
u);
127 BOOST_CHECK_EQUAL(idx0.level(2), 0
u);
133 BOOST_CHECK_EQUAL(idx4.level(0), 23
u);
134 BOOST_CHECK_EQUAL(idx4.level(1), 14
u);
135 BOOST_CHECK_EQUAL(idx4.level(2), 15
u);
136 BOOST_CHECK_EQUAL(idx4.level(3), 17
u);
139 BOOST_CHECK_EQUAL(idx3.level(0), 23
u);
140 BOOST_CHECK_EQUAL(idx3.level(1), 14
u);
141 BOOST_CHECK_EQUAL(idx3.level(2), 15
u);
142 BOOST_CHECK_EQUAL(idx3.level(3), 0
u);
145 BOOST_CHECK_EQUAL(idx2.level(0), 23
u);
146 BOOST_CHECK_EQUAL(idx2.level(1), 14
u);
147 BOOST_CHECK_EQUAL(idx2.level(2), 0
u);
148 BOOST_CHECK_EQUAL(idx2.level(3), 0
u);
151 BOOST_CHECK_EQUAL(idx1.level(0), 23
u);
152 BOOST_CHECK_EQUAL(idx1.level(1), 0
u);
153 BOOST_CHECK_EQUAL(idx1.level(2), 0
u);
154 BOOST_CHECK_EQUAL(idx1.level(3), 0
u);
158 BOOST_CHECK_EQUAL(idx0.value(), 0
u);
159 BOOST_CHECK_EQUAL(idx0.level(0), 0
u);
160 BOOST_CHECK_EQUAL(idx0.level(1), 0
u);
161 BOOST_CHECK_EQUAL(idx0.level(2), 0
u);
162 BOOST_CHECK_EQUAL(idx0.level(3), 0
u);
177 BOOST_CHECK_EQUAL(idx.makeNextSibling(3),
192 auto max1 = (1
u << 17) - 1
u;
193 auto max2 = (1
u << 21) - 1
u;
194 auto max3 = (1
u << 13) - 1
u;
195 BOOST_CHECK_EQUAL(idx.makeLastDescendant(0),
197 BOOST_CHECK_EQUAL(idx.makeLastDescendant(1),
199 BOOST_CHECK_EQUAL(idx.makeLastDescendant(2),
202 BOOST_CHECK_EQUAL(idx.makeLastDescendant(3),
207 std::unordered_set<Index32>
set;
213 BOOST_CHECK(not
set.count(
Index32(0
u)));
214 BOOST_CHECK(not
set.count(
Index32(UINT32_MAX)));
215 BOOST_CHECK_EQUAL(
set.size(), 3);
217 BOOST_CHECK(
set.count(0x00010204u));
218 BOOST_CHECK(
set.count(0x00010304u));
223 std::unordered_set<Index64>
set;
231 BOOST_CHECK(not
set.count(
Index64(0
u)));
232 BOOST_CHECK(not
set.count(
Index64(UINT64_MAX)));
233 BOOST_CHECK_EQUAL(
set.size(), 3);