9 #include <boost/test/unit_test.hpp>
12 #include <type_traits>
13 #include <unordered_set>
15 #include <boost/mpl/list.hpp>
23 using Indices = boost::mpl::list<Index32, Index64>;
29 BOOST_TEST(std::is_standard_layout_v<T>);
30 BOOST_TEST(std::is_trivially_default_constructible_v<T>);
31 BOOST_TEST(std::is_trivially_copy_constructible_v<T>);
32 BOOST_TEST(std::is_trivially_move_constructible_v<T>);
33 BOOST_TEST((std::is_trivially_assignable_v<T, T>));
34 BOOST_TEST((std::is_trivially_copy_assignable_v<T>));
35 BOOST_TEST((std::is_trivially_move_assignable_v<T>));
42 BOOST_TEST(idx.
value() == 0xabcd2400
u);
43 BOOST_TEST(idx.
level(0) == 0xabcd
u);
44 BOOST_TEST(idx.
level(1) == 0x24
u);
45 BOOST_TEST(idx.
level(2) == 0x00
u);
50 BOOST_TEST(idx.
value() == 0xabcd2400
u);
51 BOOST_TEST(idx.
level(0) == 0xabcd
u);
52 BOOST_TEST(idx.
level(1) == 0x24
u);
53 BOOST_TEST(idx.
level(2) == 0x00
u);
61 BOOST_TEST(idx.
value() == 0x00180000
u);
62 BOOST_TEST(idx.
level(0) == 24
u);
63 BOOST_TEST(idx.
level(1) == 0
u);
64 BOOST_TEST(idx.
level(2) == 0
u);
67 BOOST_TEST(idx.
value() == 0x001800ff
u);
68 BOOST_TEST(idx.
level(0) == 24
u);
69 BOOST_TEST(idx.
level(1) == 0
u);
70 BOOST_TEST(idx.
level(2) == 255
u);
82 for (
auto maxValue : maxValues) {
99 for (
auto maxValue : maxValues) {
109 BOOST_TEST(idx3.level(0) == 13
u);
110 BOOST_TEST(idx3.level(1) == 14
u);
111 BOOST_TEST(idx3.level(2) == 15
u);
114 BOOST_TEST(idx2.level(0) == 13
u);
115 BOOST_TEST(idx2.level(1) == 14
u);
116 BOOST_TEST(idx2.level(2) == 0
u);
119 BOOST_TEST(idx1.level(0) == 13
u);
120 BOOST_TEST(idx1.level(1) == 0
u);
121 BOOST_TEST(idx1.level(2) == 0
u);
125 BOOST_TEST(idx0.value() == 0
u);
126 BOOST_TEST(idx0.level(0) == 0
u);
127 BOOST_TEST(idx0.level(1) == 0
u);
128 BOOST_TEST(idx0.level(2) == 0
u);
134 BOOST_TEST(idx4.level(0) == 23
u);
135 BOOST_TEST(idx4.level(1) == 14
u);
136 BOOST_TEST(idx4.level(2) == 15
u);
137 BOOST_TEST(idx4.level(3) == 17
u);
140 BOOST_TEST(idx3.level(0) == 23
u);
141 BOOST_TEST(idx3.level(1) == 14
u);
142 BOOST_TEST(idx3.level(2) == 15
u);
143 BOOST_TEST(idx3.level(3) == 0
u);
146 BOOST_TEST(idx2.level(0) == 23
u);
147 BOOST_TEST(idx2.level(1) == 14
u);
148 BOOST_TEST(idx2.level(2) == 0
u);
149 BOOST_TEST(idx2.level(3) == 0
u);
152 BOOST_TEST(idx1.level(0) == 23
u);
153 BOOST_TEST(idx1.level(1) == 0
u);
154 BOOST_TEST(idx1.level(2) == 0
u);
155 BOOST_TEST(idx1.level(3) == 0
u);
159 BOOST_TEST(idx0.value() == 0
u);
160 BOOST_TEST(idx0.level(0) == 0
u);
161 BOOST_TEST(idx0.level(1) == 0
u);
162 BOOST_TEST(idx0.level(2) == 0
u);
163 BOOST_TEST(idx0.level(3) == 0
u);
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_TEST(
idx.makeLastDescendant(0) ==
200 BOOST_TEST(
idx.makeLastDescendant(3) ==
205 std::unordered_set<Index32>
set;
211 BOOST_TEST(not
set.count(
Index32(0
u)));
212 BOOST_TEST(not
set.count(
Index32(UINT32_MAX)));
213 BOOST_TEST(
set.size() == 3);
215 BOOST_TEST(
set.count(0x00010204u));
216 BOOST_TEST(
set.count(0x00010304u));
221 std::unordered_set<Index64>
set;
229 BOOST_TEST(not
set.count(
Index64(0
u)));
230 BOOST_TEST(not
set.count(
Index64(UINT64_MAX)));
231 BOOST_TEST(
set.size() == 3);