ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PerigeeSurfaceTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PerigeeSurfaceTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
12 
13 #include <limits>
14 
17 #include "Acts/Surfaces/InfiniteBounds.hpp" //to get s_noBounds
19 #include "Acts/Surfaces/RectangleBounds.hpp" //to get s_noBounds
22 
23 using boost::test_tools::output_test_stream;
24 namespace utf = boost::unit_test;
25 
26 namespace Acts {
27 
28 namespace Test {
29 
30 // Create a test context
32 
33 BOOST_AUTO_TEST_SUITE(PerigeeSurfaces)
35 BOOST_AUTO_TEST_CASE(PerigeeSurfaceConstruction) {
36  // PerigeeSurface default constructor is deleted
37  //
39  Vector3D unitXYZ{1., 1., 1.};
40  auto perigeeSurfaceObject = Surface::makeShared<PerigeeSurface>(unitXYZ);
41  BOOST_CHECK_EQUAL(Surface::makeShared<PerigeeSurface>(unitXYZ)->type(),
43  //
45  Translation3D translation{0., 1., 2.};
46  auto pTransform = std::make_shared<const Transform3D>(translation);
47  std::shared_ptr<const Transform3D> pNullTransform{};
48  BOOST_CHECK_EQUAL(Surface::makeShared<PerigeeSurface>(pNullTransform)->type(),
50  BOOST_CHECK_EQUAL(Surface::makeShared<PerigeeSurface>(pTransform)->type(),
52  //
54  auto copiedPerigeeSurface =
55  Surface::makeShared<PerigeeSurface>(*perigeeSurfaceObject);
56  BOOST_CHECK_EQUAL(copiedPerigeeSurface->type(), Surface::Perigee);
57  BOOST_CHECK(*copiedPerigeeSurface == *perigeeSurfaceObject);
58  //
60  auto copiedTransformedPerigeeSurface = Surface::makeShared<PerigeeSurface>(
61  tgContext, *perigeeSurfaceObject, *pTransform);
62  BOOST_CHECK_EQUAL(copiedTransformedPerigeeSurface->type(), Surface::Perigee);
63 }
64 //
66 BOOST_AUTO_TEST_CASE(PerigeeSurfaceProperties) {
68  Vector3D unitXYZ{1., 1., 1.};
69  auto perigeeSurfaceObject = Surface::makeShared<PerigeeSurface>(unitXYZ);
70  //
72  BOOST_CHECK_EQUAL(perigeeSurfaceObject->type(), Surface::Perigee);
73  //
75  BOOST_CHECK_EQUAL(perigeeSurfaceObject->name(),
76  std::string("Acts::PerigeeSurface"));
77  //
79  boost::test_tools::output_test_stream dumpOuput;
80  perigeeSurfaceObject->toStream(tgContext, dumpOuput);
81  BOOST_CHECK(
82  dumpOuput.is_equal("Acts::PerigeeSurface:\n\
83  Center position (x, y, z) = (1.0000000, 1.0000000, 1.0000000)"));
84 }
85 
86 BOOST_AUTO_TEST_CASE(EqualityOperators) {
87  Vector3D unitXYZ{1., 1., 1.};
88  Vector3D invalidPosition{0.0, 0.0, 0.0};
89  auto perigeeSurfaceObject = Surface::makeShared<PerigeeSurface>(unitXYZ);
90  auto perigeeSurfaceObject2 = Surface::makeShared<PerigeeSurface>(unitXYZ);
91  auto assignedPerigeeSurface =
92  Surface::makeShared<PerigeeSurface>(invalidPosition);
94  BOOST_CHECK(*perigeeSurfaceObject == *perigeeSurfaceObject2);
96  *assignedPerigeeSurface = *perigeeSurfaceObject;
98  BOOST_CHECK(*assignedPerigeeSurface == *perigeeSurfaceObject);
99 }
100 
101 BOOST_AUTO_TEST_SUITE_END()
102 
103 } // namespace Test
104 
105 } // namespace Acts