27 #define BOOST_TEST_MODULE ( PointIsolationAlg_test )
28 #include "boost/test/unit_test.hpp"
48 BOOST_TEST(
indices.dim<0>() == 4U);
50 BOOST_TEST(
indices.size<0>() == 4U);
52 BOOST_TEST(
indices.size() == 4U);
59 std::array<char, 1> ii {{ 1 }};
69 BOOST_TEST(
indices(ii.begin()) == 1U);
72 BOOST_CHECK_NO_THROW(
indices(4));
74 BOOST_TEST(
indices.at(0) == 0U);
75 BOOST_TEST(
indices.at(1) == 1U);
76 BOOST_TEST(
indices.at(ii.begin()) == 1U);
77 BOOST_TEST(
indices.at(2) == 2U);
78 BOOST_TEST(
indices.at(3) == 3U);
79 BOOST_CHECK_THROW(
indices.at(4), std::out_of_range);
83 BOOST_TEST(
indices.has(ii.begin()));
88 BOOST_TEST(
indices.hasIndex<0>(0));
89 BOOST_TEST(
indices.hasIndex<0>(1));
90 BOOST_TEST(
indices.hasIndex<0>(2));
91 BOOST_TEST(
indices.hasIndex<0>(3));
92 BOOST_TEST(!
indices.hasIndex<0>(4));
93 BOOST_TEST(!
indices.hasIndex<0>(5));
95 BOOST_TEST(
indices.hasLinIndex(0U));
99 BOOST_TEST(
indices.size() == 4U);
104 std::array<int, 1> ia {{ 4 }};
110 BOOST_TEST((indicesAgain ==
indices));
111 BOOST_TEST(!(indicesAgain !=
indices));
112 BOOST_TEST((indicesOther !=
indices));
113 BOOST_TEST(!(indicesOther ==
indices));
114 BOOST_TEST((indicesRank !=
indices));
115 BOOST_TEST(!(indicesRank ==
indices));
132 BOOST_TEST(
indices.dim<0>() == 4U);
133 BOOST_TEST(
indices.dim<1>() == 3U);
135 BOOST_TEST(
indices.size<0>() == 4U * 3U);
136 BOOST_TEST(
indices.size<1>() == 3U);
138 BOOST_TEST(
indices.size() == 4U * 3U);
140 BOOST_TEST(
indices.minorTensor().rank() == 1U);
141 BOOST_TEST(
indices.minorTensor().size() == 3U);
148 std::array<char, 2> ii {{ 1, 2 }};
156 BOOST_TEST(
indices(0, 0) == 0U);
157 BOOST_TEST(
indices(1, 2) == 5U);
158 BOOST_TEST(
indices(ii.begin()) == 5U);
159 BOOST_CHECK_NO_THROW(
indices(1, 3));
160 BOOST_CHECK_NO_THROW(
indices(4, 2));
161 BOOST_CHECK_NO_THROW(
indices(7, 6));
163 BOOST_TEST(
indices.at(0, 0) == 0U);
164 BOOST_TEST(
indices.at(1, 2) == 5U);
165 BOOST_TEST(
indices.at(ii.begin()) == 5U);
166 BOOST_CHECK_THROW(
indices.at(1, 3), std::out_of_range);
167 BOOST_CHECK_THROW(
indices.at(4, 2), std::out_of_range);
168 BOOST_CHECK_THROW(
indices.at(7, 6), std::out_of_range);
171 BOOST_TEST(
indices.has(ii.begin()));
173 BOOST_TEST(!
indices.has(1, 3));
174 BOOST_TEST(!
indices.has(4, 2));
175 BOOST_TEST(!
indices.has(7, 6));
177 BOOST_TEST(
indices.hasIndex<0>(0));
178 BOOST_TEST(
indices.hasIndex<0>(3));
179 BOOST_TEST(!
indices.hasIndex<0>(4));
180 BOOST_TEST(
indices.hasIndex<1>(0));
181 BOOST_TEST(
indices.hasIndex<1>(2));
182 BOOST_TEST(!
indices.hasIndex<1>(3));
184 BOOST_TEST(
indices.hasLinIndex(0U));
194 std::array<int, 2> ia {{ 4, 3 }};
200 BOOST_TEST((indicesAgain ==
indices));
201 BOOST_TEST(!(indicesAgain !=
indices));
202 BOOST_TEST((indicesOther !=
indices));
203 BOOST_TEST(!(indicesOther ==
indices));
204 BOOST_TEST((indicesRank !=
indices));
205 BOOST_TEST(!(indicesRank ==
indices));
221 BOOST_TEST(
indices.dim<0>() == 2U);
222 BOOST_TEST(
indices.dim<1>() == 3U);
223 BOOST_TEST(
indices.dim<2>() == 4U);
225 BOOST_TEST(
indices.size<0>() == 2U * 3U * 4U);
226 BOOST_TEST(
indices.size<1>() == 3U * 4U);
227 BOOST_TEST(
indices.size<2>() == 4U);
229 BOOST_TEST(
indices.size() == 2U * 3U * 4U);
231 BOOST_TEST(
indices.minorTensor().rank() == 2U);
232 BOOST_TEST(
indices.minorTensor().size() == 3U * 4U);
239 std::array<char, 3> ii {{ 1, 2, 3 }};
247 BOOST_TEST(
indices(0, 0, 0) == 0U);
248 BOOST_TEST(
indices(1, 2, 3) == 23U);
249 BOOST_TEST(
indices(ii.begin()) == 23U);
250 BOOST_CHECK_NO_THROW(
indices(1, 3, 1));
251 BOOST_CHECK_NO_THROW(
indices(4, 2, 1));
252 BOOST_CHECK_NO_THROW(
indices(1, 2, 6));
253 BOOST_CHECK_NO_THROW(
indices(7, 6, 6));
255 BOOST_TEST(
indices.at(0, 0, 0) == 0U);
256 BOOST_TEST(
indices.at(1, 2, 3) == 23U);
257 BOOST_TEST(
indices.at(ii.begin()) == 23U);
258 BOOST_CHECK_THROW(
indices.at(1, 3, 1), std::out_of_range);
259 BOOST_CHECK_THROW(
indices.at(4, 2, 1), std::out_of_range);
260 BOOST_CHECK_THROW(
indices.at(1, 2, 6), std::out_of_range);
261 BOOST_CHECK_THROW(
indices.at(7, 6, 6), std::out_of_range);
263 BOOST_TEST(
indices.has(0, 0, 0));
264 BOOST_TEST(
indices.has(1, 2, 3));
265 BOOST_TEST(
indices.has(ii.begin()));
266 BOOST_TEST(!
indices.has(1, 3, 1));
267 BOOST_TEST(!
indices.has(4, 2, 1));
268 BOOST_TEST(!
indices.has(1, 2, 6));
269 BOOST_TEST(!
indices.has(7, 6, 6));
271 BOOST_TEST(
indices.hasIndex<0>(0));
272 BOOST_TEST(
indices.hasIndex<0>(1));
273 BOOST_TEST(!
indices.hasIndex<0>(2));
274 BOOST_TEST(
indices.hasIndex<1>(0));
275 BOOST_TEST(
indices.hasIndex<1>(2));
276 BOOST_TEST(!
indices.hasIndex<1>(3));
277 BOOST_TEST(
indices.hasIndex<2>(0));
278 BOOST_TEST(
indices.hasIndex<2>(3));
279 BOOST_TEST(!
indices.hasIndex<2>(4));
281 BOOST_TEST(
indices.hasLinIndex(0U));
291 std::array<int, 3> ia {{ 2, 3, 4 }};
297 BOOST_TEST((indicesAgain ==
indices));
298 BOOST_TEST(!(indicesAgain !=
indices));
299 BOOST_TEST((indicesOther !=
indices));
300 BOOST_TEST(!(indicesOther ==
indices));
301 BOOST_TEST((indicesRank !=
indices));
302 BOOST_TEST(!(indicesRank ==
indices));
void TensorRank3Test()
Test for a rank 3 tensor.
TensorIndices class to flatten multi-dimension indices into linear.
Converts a tensor element specification into a linear index.
constexpr std::array< std::size_t, geo::vect::dimension< Vector >)> indices()
Returns a sequence of indices valid for a vector of the specified type.
void MatrixTest(Array const &mat)
auto makeTensorIndices(DIMS...dims)
Instantiates a TensorIndices class with the specified dimensions.