File indexing completed on 2025-01-18 09:12:43
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Common.hpp"
0013 #include "Acts/Definitions/Direction.hpp"
0014 #include "Acts/Material/ISurfaceMaterial.hpp"
0015 #include "Acts/Material/MaterialSlab.hpp"
0016
0017 #include <ostream>
0018
0019 namespace Acts::Test {
0020
0021 class SurfaceMaterialStub : public ISurfaceMaterial {
0022 using ISurfaceMaterial::ISurfaceMaterial;
0023
0024 ISurfaceMaterial& scale(double ) override { return *this; };
0025
0026 const MaterialSlab& materialSlab(const Vector2& ) const override {
0027 return m_fullMaterial;
0028 }
0029
0030 const MaterialSlab& materialSlab(const Vector3& ) const override {
0031 return m_fullMaterial;
0032 }
0033
0034 std::ostream& toStream(std::ostream& sl) const override {
0035 sl << "SurfaceMaterialStub";
0036 return sl;
0037 };
0038
0039 MaterialSlab m_fullMaterial{};
0040 };
0041
0042
0043 BOOST_AUTO_TEST_CASE(ISurfaceMaterial_factor_test) {
0044 double splitFactor = 42.0;
0045 SurfaceMaterialStub stub{splitFactor};
0046
0047 BOOST_CHECK_EQUAL(
0048 stub.factor(Direction::Forward(), MaterialUpdateStage::FullUpdate), 1.0);
0049
0050 BOOST_CHECK_EQUAL(
0051 stub.factor(Direction::Backward(), MaterialUpdateStage::FullUpdate), 1.0);
0052
0053 BOOST_CHECK_EQUAL(
0054 stub.factor(Direction::Forward(), MaterialUpdateStage::PostUpdate),
0055 splitFactor);
0056
0057 BOOST_CHECK_EQUAL(
0058 stub.factor(Direction::Backward(), MaterialUpdateStage::PreUpdate),
0059 splitFactor);
0060
0061 BOOST_CHECK_EQUAL(
0062 stub.factor(Direction::Forward(), MaterialUpdateStage::PreUpdate),
0063 1 - splitFactor);
0064
0065 BOOST_CHECK_EQUAL(
0066 stub.factor(Direction::Backward(), MaterialUpdateStage::PostUpdate),
0067 1 - splitFactor);
0068 }
0069
0070 }