File indexing completed on 2025-01-18 09:12:56
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Utilities/detail/Extendable.hpp"
0012
0013 #include <tuple>
0014 #include <type_traits>
0015
0016 namespace Acts::Test {
0017
0018
0019
0020 BOOST_AUTO_TEST_CASE(Extendable_) {
0021 struct TypeA {
0022 double vaA = 0.;
0023 };
0024
0025 struct TypeB {
0026 int vaB = 0;
0027 };
0028
0029 struct TypeC {
0030 char vaC = '0';
0031 };
0032
0033
0034 detail::Extendable<> nullist{};
0035 (void)nullist;
0036 BOOST_CHECK_EQUAL(std::tuple_size_v<std::tuple<>>, 0u);
0037
0038 detail::Extendable<TypeA> alist;
0039 auto& a0_object = alist.get<TypeA>();
0040 a0_object.vaA = 1.;
0041 BOOST_CHECK_EQUAL(alist.get<TypeA>().vaA, 1.);
0042
0043 detail::Extendable<TypeA, TypeB> ablist;
0044 auto& a1_object = ablist.get<TypeA>();
0045 a1_object.vaA = 2.;
0046 auto& b1_object = ablist.get<TypeB>();
0047 b1_object.vaB = 3;
0048 BOOST_CHECK_EQUAL(ablist.get<TypeA>().vaA, 2.);
0049 BOOST_CHECK_EQUAL(ablist.get<TypeB>().vaB, 3);
0050
0051 TypeC c;
0052 c.vaC = '4';
0053 detail::Extendable<TypeA, TypeB, TypeC> abcList = ablist.append<TypeC>(c);
0054 BOOST_CHECK_EQUAL(abcList.get<TypeA>().vaA, 2.);
0055 BOOST_CHECK_EQUAL(abcList.get<TypeB>().vaB, 3);
0056 BOOST_CHECK_EQUAL(abcList.get<TypeC>().vaC, '4');
0057 }
0058
0059 }