9 #include <boost/test/unit_test.hpp>
16 using namespace Acts::VectorHelpers;
21 BOOST_AUTO_TEST_SUITE(Utilities)
24 Eigen::Matrix<int, 4, 3>
mat;
25 mat << 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0;
28 std::bitset<4 * 3> exp{
"101001011010"};
30 BOOST_CHECK_EQUAL(exp, act);
32 Eigen::Matrix<int, 4, 3> cnv;
33 cnv = bitsetToMatrix<decltype(cnv)>(act);
35 BOOST_CHECK_EQUAL(mat, cnv);
39 double phi()
const {
return 42; }
52 BOOST_CHECK_EQUAL(
phi(s), 42
u);
81 mat << 1, 2, 3, 4, 5, 6, 7, 8, 9;
85 exp << -2, -1, 0, 4, 2, 0, -2, -1, 0;
95 mat << 1, 2, 3, 4, 5, 6, 7, 8, 9;
99 exp << -2, -1, 0, 4, 2, 0, -2, -1, 0;
101 BOOST_CHECK(act.isApprox(exp, 1
e-9));
107 mat << 1, 2, 3, 4, 5, 6, 7, 8, 9;
110 BOOST_CHECK(out.size() > 0);
114 BOOST_CHECK(out.size() > 0);
119 BOOST_CHECK(out.size() > 0);
124 std::vector<std::shared_ptr<int>> vec;
125 vec = {std::make_shared<int>(5), std::make_shared<int>(9),
126 std::make_shared<int>(26), std::make_shared<int>(18473)};
130 std::vector<int*> exp = {
137 BOOST_CHECK_EQUAL_COLLECTIONS(unpacked.begin(), unpacked.end(), exp.begin(),
143 std::vector<std::shared_ptr<const int>> vec;
144 vec = {std::make_shared<const int>(5), std::make_shared<const int>(9),
145 std::make_shared<const int>(26), std::make_shared<const int>(18473)};
149 std::vector<const int*> exp = {
156 BOOST_CHECK_EQUAL_COLLECTIONS(unpacked.begin(), unpacked.end(), exp.begin(),
164 double t =
time(spaceTimeVec);
165 BOOST_CHECK_EQUAL(spaceTimeVec[3], t);
168 time(spaceTimeVec) = newTime;
169 BOOST_CHECK_EQUAL(spaceTimeVec[3], newTime);
172 boundVec << 1., 2., 3., 4., 5., 6.;
174 BOOST_CHECK_EQUAL(boundVec[
eT], t);
177 time(boundVec) = newTime;
178 BOOST_CHECK_EQUAL(boundVec[eT], newTime);
181 freeVec << 1., 2., 3., 4., 5., 6., 7., 8.;
183 BOOST_CHECK_EQUAL(freeVec[7], t);
186 time(freeVec) = newTime;
187 BOOST_CHECK_EQUAL(freeVec[7], newTime);
195 const double t1 =
time(spaceTimeVec);
196 BOOST_CHECK_EQUAL(spaceTimeVec[3], t1);
199 tempBoundVec << 1., 2., 3., 4., 5., 6.;
201 const double t2 =
time(boundVec);
202 BOOST_CHECK_EQUAL(boundVec[
eT], t2);
205 tempFreeVec << 1., 2., 3., 4., 5., 6., 7., 8.;
207 const double t3 =
time(freeVec);
208 BOOST_CHECK_EQUAL(freeVec[7], t3);
216 BOOST_CHECK_EQUAL(spaceTimeVec.head<3>(), pos);
220 BOOST_CHECK_EQUAL(spaceTimeVec.head<3>(), newPos);
223 freeVec << 1., 2., 3., 4., 5., 6., 7., 8.;
225 BOOST_CHECK_EQUAL(freeVec.head<3>(), pos);
227 newPos = {14., 17., 112.};
229 BOOST_CHECK_EQUAL(freeVec.head<3>(), newPos);
238 BOOST_CHECK_EQUAL(spaceTimeVec.head<3>(), pos1);
241 tempFreeVec << 1., 2., 3., 4., 5., 6., 7., 8.;
244 BOOST_CHECK_EQUAL(freeVec.head<3>(), pos2);
254 constexpr
size_t imax = 20;
255 for (
size_t i = 0; i <
imax; i++) {
256 size_t val = template_switch<functor, 0, imax>(i);
257 BOOST_CHECK_EQUAL(val, i * i * i);
261 BOOST_AUTO_TEST_SUITE_END()