9 #include <boost/test/unit_test.hpp>
24 namespace tt = boost::test_tools;
42 auto planeSurface = Surface::makeShared<PlaneSurface>(
position, direction);
43 auto otherSurface = Surface::makeShared<PlaneSurface>(
48 freeParameters << position[0], position[1], position[2],
time, direction[0],
49 direction[1], direction[2], qop;
57 CovarianceCache covCache(tgContext, *planeSurface, position, boundParameters,
62 BOOST_CHECK_EQUAL(std::get<BoundSquareMatrix>(covCache.
covariance),
64 BOOST_CHECK_THROW(std::get<FreeSquareMatrix>(covCache.
covariance),
65 std::bad_variant_access);
69 BoundToFreeMatrix::Zero()));
74 BOOST_CHECK_EQUAL(covCache.
atSurface, planeSurface.get());
75 BOOST_CHECK_EQUAL(covCache.
atPosition, position);
79 freeParameters, covCache);
80 BOOST_CHECK(boundCovariance.isApprox(
81 std::get<BoundSquareMatrix>(covCache.
covariance)));
82 BOOST_CHECK_THROW(std::get<FreeSquareMatrix>(covCache.
covariance),
83 std::bad_variant_access);
85 auto variantCovariance = std::get<0>(covJacAtBound);
86 auto variantJacobian = std::get<1>(covJacAtBound);
87 BOOST_CHECK_THROW(std::get<FreeSquareMatrix>(variantCovariance),
88 std::bad_variant_access);
92 BOOST_CHECK(boundCovariance.isApprox(
93 std::get<BoundSquareMatrix>(covCache.
covariance)));
94 BOOST_CHECK_THROW(std::get<FreeSquareMatrix>(covCache.
covariance),
95 std::bad_variant_access);
97 variantCovariance = std::get<0>(covJacAtCurv);
98 variantJacobian = std::get<1>(covJacAtCurv);
99 BOOST_CHECK_THROW(std::get<FreeSquareMatrix>(variantCovariance),
100 std::bad_variant_access);
104 variantCovariance = std::get<0>(covJacAtFree);
105 variantJacobian = std::get<1>(covJacAtFree);
106 BOOST_CHECK_THROW(std::get<BoundSquareMatrix>(variantCovariance),
107 std::bad_variant_access);
111 freeParameters, covCache);
113 variantCovariance = std::get<0>(covJacAtBound);
114 variantJacobian = std::get<1>(covJacAtBound);
115 BOOST_CHECK_THROW(std::get<FreeSquareMatrix>(variantCovariance),
116 std::bad_variant_access);
130 freeParameters <<
position[0], position[1], position[2],
time, direction[0],
131 direction[1], direction[2], qop;
133 auto planeSurface = Surface::makeShared<PlaneSurface>(
position, direction);
141 BOOST_CHECK_EQUAL(std::get<BoundSquareMatrix>(covCache.
covariance),
143 BOOST_CHECK_THROW(std::get<FreeSquareMatrix>(covCache.
covariance),
144 std::bad_variant_access);
149 BoundToFreeMatrix::Zero()));
154 BOOST_CHECK_EQUAL(covCache.
atSurface,
nullptr);
155 BOOST_CHECK_EQUAL(covCache.
atPosition, position);
159 freeParameters, covCache);
160 auto variantCovariance = std::get<0>(covJacAtBound);
161 auto variantJacobian = std::get<1>(covJacAtBound);
162 BOOST_CHECK_THROW(std::get<FreeSquareMatrix>(variantCovariance),
163 std::bad_variant_access);
167 variantCovariance = std::get<0>(covJacAtCurv);
168 variantJacobian = std::get<1>(covJacAtCurv);
169 BOOST_CHECK_THROW(std::get<FreeSquareMatrix>(variantCovariance),
170 std::bad_variant_access);
174 variantCovariance = std::get<0>(covJacAtFree);
175 variantJacobian = std::get<1>(covJacAtFree);
176 BOOST_CHECK_THROW(std::get<BoundSquareMatrix>(variantCovariance),
177 std::bad_variant_access);
189 auto planeSurface = Surface::makeShared<PlaneSurface>(
position, direction);
193 freeParameters << position[0], position[1], position[2],
time, direction[0],
194 direction[1], direction[2], qop;
201 BOOST_CHECK_THROW(std::get<BoundSquareMatrix>(covCache.
covariance),
202 std::bad_variant_access);
203 BOOST_CHECK_EQUAL(std::get<FreeSquareMatrix>(covCache.
covariance),
211 BOOST_CHECK_EQUAL(covCache.
atSurface,
nullptr);
212 BOOST_CHECK_EQUAL(covCache.
atPosition, position);
216 freeParameters, covCache);
218 auto variantCovariance = std::get<0>(covJacAtBound);
219 auto variantJacobian = std::get<1>(covJacAtBound);
220 BOOST_CHECK_THROW(std::get<FreeSquareMatrix>(variantCovariance),
221 std::bad_variant_access);
225 variantCovariance = std::get<0>(covJacAtCurv);
226 variantJacobian = std::get<1>(covJacAtCurv);
227 BOOST_CHECK_THROW(std::get<FreeSquareMatrix>(variantCovariance),
228 std::bad_variant_access);
232 variantCovariance = std::get<0>(covJacAtFree);
233 variantJacobian = std::get<1>(covJacAtFree);
234 BOOST_CHECK_THROW(std::get<BoundSquareMatrix>(variantCovariance),
235 std::bad_variant_access);