File indexing completed on 2025-08-06 08:11:19
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/Units.hpp"
0012 #include "Acts/EventData/SourceLink.hpp"
0013 #include "Acts/EventData/detail/TestSourceLink.hpp"
0014 #include "Acts/Geometry/GeometryIdentifier.hpp"
0015
0016 #include <any>
0017 #include <sstream>
0018
0019 using namespace Acts::UnitLiterals;
0020
0021 BOOST_AUTO_TEST_SUITE(EventDataSourceLink)
0022
0023 BOOST_AUTO_TEST_CASE(TestSourceLinkCoverage) {
0024 using Acts::detail::Test::TestSourceLink;
0025 TestSourceLink ts;
0026 Acts::Vector2 stddev(0.01, 0.1);
0027 Acts::SquareMatrix2 cov = stddev.cwiseProduct(stddev).asDiagonal();
0028 TestSourceLink l1(Acts::eBoundLoc0, 0.1, cov(0, 0),
0029 Acts::GeometryIdentifier(0x999), 0);
0030 TestSourceLink l2(l1);
0031
0032 BOOST_CHECK(l1 == l2);
0033 BOOST_CHECK(!(l1 != l2));
0034 std::ostringstream str;
0035 str << l1;
0036 }
0037
0038 struct MySourceLink {
0039 Acts::GeometryIdentifier m_geometryId;
0040
0041 Acts::GeometryIdentifier geometryId() const { return m_geometryId; }
0042 };
0043
0044 BOOST_AUTO_TEST_CASE(Construct) {
0045 MySourceLink msl;
0046 msl.m_geometryId.setSensitive(42);
0047 {
0048 Acts::SourceLink sl{msl};
0049 BOOST_CHECK_EQUAL(sl.get<MySourceLink>().geometryId(), msl.geometryId());
0050 BOOST_CHECK_THROW(sl.get<int>(), std::bad_any_cast);
0051 }
0052 }
0053
0054 BOOST_AUTO_TEST_SUITE_END()