File indexing completed on 2025-01-18 09:12:51
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/tools/output_test_stream.hpp>
0010 #include <boost/test/unit_test.hpp>
0011
0012 #include "Acts/Definitions/Algebra.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Surfaces/PerigeeSurface.hpp"
0015 #include "Acts/Surfaces/Surface.hpp"
0016
0017 #include <memory>
0018 #include <string>
0019
0020 namespace Acts::Test {
0021
0022
0023 GeometryContext tgContext = GeometryContext();
0024
0025 BOOST_AUTO_TEST_SUITE(PerigeeSurfaces)
0026
0027 BOOST_AUTO_TEST_CASE(PerigeeSurfaceConstruction) {
0028
0029
0030
0031
0032 Vector3 unitXYZ{1., 1., 1.};
0033 auto perigeeSurfaceObject = Surface::makeShared<PerigeeSurface>(unitXYZ);
0034 BOOST_CHECK_EQUAL(Surface::makeShared<PerigeeSurface>(unitXYZ)->type(),
0035 Surface::Perigee);
0036
0037
0038 Translation3 translation{0., 1., 2.};
0039 auto pTransform = Transform3(translation);
0040 BOOST_CHECK_EQUAL(Surface::makeShared<PerigeeSurface>(pTransform)->type(),
0041 Surface::Perigee);
0042
0043
0044 auto copiedPerigeeSurface =
0045 Surface::makeShared<PerigeeSurface>(*perigeeSurfaceObject);
0046 BOOST_CHECK_EQUAL(copiedPerigeeSurface->type(), Surface::Perigee);
0047 BOOST_CHECK(*copiedPerigeeSurface == *perigeeSurfaceObject);
0048
0049
0050 auto copiedTransformedPerigeeSurface = Surface::makeShared<PerigeeSurface>(
0051 tgContext, *perigeeSurfaceObject, pTransform);
0052 BOOST_CHECK_EQUAL(copiedTransformedPerigeeSurface->type(), Surface::Perigee);
0053 }
0054
0055
0056 BOOST_AUTO_TEST_CASE(PerigeeSurfaceProperties) {
0057
0058 Vector3 unitXYZ{1., 1., 1.};
0059 auto perigeeSurfaceObject = Surface::makeShared<PerigeeSurface>(unitXYZ);
0060
0061
0062 BOOST_CHECK_EQUAL(perigeeSurfaceObject->type(), Surface::Perigee);
0063
0064
0065 BOOST_CHECK_EQUAL(perigeeSurfaceObject->name(),
0066 std::string("Acts::PerigeeSurface"));
0067
0068
0069 boost::test_tools::output_test_stream dumpOutput;
0070 dumpOutput << perigeeSurfaceObject->toStream(tgContext);
0071 BOOST_CHECK(
0072 dumpOutput.is_equal("Acts::PerigeeSurface:\n\
0073 Center position (x, y, z) = (1.0000000, 1.0000000, 1.0000000)"));
0074 }
0075
0076 BOOST_AUTO_TEST_CASE(EqualityOperators) {
0077 Vector3 unitXYZ{1., 1., 1.};
0078 Vector3 invalidPosition{0., 0., 0.};
0079 auto perigeeSurfaceObject = Surface::makeShared<PerigeeSurface>(unitXYZ);
0080 auto perigeeSurfaceObject2 = Surface::makeShared<PerigeeSurface>(unitXYZ);
0081 auto assignedPerigeeSurface =
0082 Surface::makeShared<PerigeeSurface>(invalidPosition);
0083
0084
0085 BOOST_CHECK(*perigeeSurfaceObject == *perigeeSurfaceObject2);
0086
0087
0088 *assignedPerigeeSurface = *perigeeSurfaceObject;
0089
0090
0091 BOOST_CHECK(*assignedPerigeeSurface == *perigeeSurfaceObject);
0092 }
0093
0094 BOOST_AUTO_TEST_SUITE_END()
0095 }