File indexing completed on 2025-08-06 08:11:29
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/data/test_case.hpp>
0010 #include <boost/test/tools/output_test_stream.hpp>
0011 #include <boost/test/unit_test.hpp>
0012
0013 #include "Acts/Definitions/Algebra.hpp"
0014 #include "Acts/Surfaces/BoundaryCheck.hpp"
0015 #include "Acts/Surfaces/SurfaceBounds.hpp"
0016
0017 #include <cstddef>
0018 #include <numeric>
0019 #include <ostream>
0020 #include <vector>
0021
0022 namespace Acts {
0023
0024
0025 class SurfaceBoundsStub : public SurfaceBounds {
0026 public:
0027
0028 explicit SurfaceBoundsStub(std::size_t nValues = 0) : m_values(nValues, 0) {
0029 std::iota(m_values.begin(), m_values.end(), 0);
0030 }
0031
0032 #if defined(__GNUC__) && __GNUC__ == 13 && !defined(__clang__)
0033 #pragma GCC diagnostic push
0034 #pragma GCC diagnostic ignored "-Warray-bounds"
0035 #pragma GCC diagnostic ignored "-Wstringop-overflow"
0036 #endif
0037 SurfaceBoundsStub(const SurfaceBoundsStub& other) = default;
0038 #if defined(__GNUC__) && __GNUC__ == 13 && !defined(__clang__)
0039 #pragma GCC diagnostic pop
0040 #endif
0041
0042 ~SurfaceBoundsStub() override = default;
0043 BoundsType type() const final {
0044 return SurfaceBounds::eOther;
0045 }
0046 std::vector<double> values() const override {
0047 return m_values;
0048 }
0049 bool inside(const Vector2& ,
0050 const BoundaryCheck& ) const final {
0051 return true;
0052 }
0053
0054 std::ostream& toStream(std::ostream& sl) const final {
0055 sl << "SurfaceBoundsStub";
0056 return sl;
0057 }
0058
0059 private:
0060 std::vector<double> m_values;
0061 };
0062
0063 namespace Test {
0064 BOOST_AUTO_TEST_SUITE(Surfaces)
0065
0066 BOOST_AUTO_TEST_CASE(SurfaceBoundsConstruction) {
0067 SurfaceBoundsStub u;
0068 SurfaceBoundsStub s(1);
0069 SurfaceBoundsStub t(s);
0070 SurfaceBoundsStub v(u);
0071 }
0072 BOOST_AUTO_TEST_CASE(SurfaceBoundsProperties) {
0073 SurfaceBoundsStub surface(5);
0074 std::vector<double> reference{0, 1, 2, 3, 4};
0075 const auto& boundValues = surface.values();
0076 BOOST_CHECK_EQUAL_COLLECTIONS(reference.cbegin(), reference.cend(),
0077 boundValues.cbegin(), boundValues.cend());
0078 }
0079
0080 BOOST_AUTO_TEST_CASE(SurfaceBoundsEquality) {
0081 SurfaceBoundsStub surface(1);
0082 SurfaceBoundsStub copiedSurface(surface);
0083 SurfaceBoundsStub differentSurface(2);
0084 BOOST_CHECK_EQUAL(surface, copiedSurface);
0085 BOOST_CHECK_NE(surface, differentSurface);
0086 SurfaceBoundsStub assignedSurface;
0087 assignedSurface = surface;
0088 BOOST_CHECK_EQUAL(surface, assignedSurface);
0089 const auto& surfaceboundValues = surface.values();
0090 const auto& assignedboundValues = assignedSurface.values();
0091 BOOST_CHECK_EQUAL_COLLECTIONS(
0092 surfaceboundValues.cbegin(), surfaceboundValues.cend(),
0093 assignedboundValues.cbegin(), assignedboundValues.cend());
0094 }
0095 BOOST_AUTO_TEST_SUITE_END()
0096
0097 }
0098
0099 }