File indexing completed on 2025-12-16 09:25:20
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/data/test_case.hpp>
0010 #include <boost/test/unit_test.hpp>
0011
0012 #include "Acts/EventData/TrackStateProxy.hpp"
0013 #include "Acts/Utilities/PointerTraits.hpp"
0014
0015 #include <iostream>
0016 #include <memory>
0017
0018 using namespace Acts;
0019
0020 namespace ActsTests {
0021
0022 template <typename T>
0023 bool testPointer(const T ) {
0024 BOOST_TEST_MESSAGE("Object of " << typeid(T).name()
0025 << " does not pass the pointer concept ");
0026 return false;
0027 }
0028
0029 template <PointerConcept T>
0030 bool testPointer(const T ) {
0031 BOOST_TEST_MESSAGE("Object of " << typeid(T).name()
0032 << " passes the pointer concept ");
0033 return true;
0034 }
0035
0036 BOOST_AUTO_TEST_SUITE(UtilitiesSuite)
0037
0038 BOOST_AUTO_TEST_CASE(testConceptPass) {
0039 int* raw_ptr{nullptr};
0040 BOOST_CHECK(testPointer(raw_ptr));
0041 int raw_val{0};
0042 BOOST_CHECK(!testPointer(raw_val));
0043
0044 BOOST_CHECK(testPointer(std::unique_ptr<int>{nullptr}));
0045 BOOST_CHECK(testPointer(std::unique_ptr<const int>{nullptr}));
0046
0047 BOOST_CHECK(testPointer(std::shared_ptr<int>{nullptr}));
0048 BOOST_CHECK(testPointer(std::shared_ptr<const int>{nullptr}));
0049
0050 BOOST_CHECK(testPointer(detail_lt::TransitiveConstPointer<int>{nullptr}));
0051 BOOST_CHECK(
0052 testPointer(detail_lt::TransitiveConstPointer<const int>{nullptr}));
0053
0054 struct PartialPointerLike {
0055 int* ptr = nullptr;
0056 int* operator->() const { return ptr; }
0057
0058 };
0059 BOOST_CHECK(!testPointer(PartialPointerLike{}));
0060
0061
0062 static_assert(std::is_same_v<RemovePointer_t<std::unique_ptr<int>>, int>);
0063 static_assert(std::is_same_v<RemovePointer_t<std::shared_ptr<int>>, int>);
0064 static_assert(std::is_same_v<RemovePointer_t<int>, int>);
0065 static_assert(std::is_same_v<RemovePointer_t<int*>, int>);
0066 }
0067 BOOST_AUTO_TEST_SUITE_END()
0068
0069 }