Analysis Software
Documentation for sPHENIX simulation 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 
17 
18 #include <memory>
19 #include <string>
20 
21 using boost::test_tools::output_test_stream;
22 namespace utf = boost::unit_test;
23 
24 namespace Acts {
25 
26 namespace Test {
27 
28 // Create a test context
30 
31 BOOST_AUTO_TEST_SUITE(PerigeeSurfaces)
33 BOOST_AUTO_TEST_CASE(PerigeeSurfaceConstruction) {
34  // PerigeeSurface default constructor is deleted
35  //
37  Vector3 unitXYZ{1., 1., 1.};
38  auto perigeeSurfaceObject = Surface::makeShared<PerigeeSurface>(unitXYZ);
39  BOOST_CHECK_EQUAL(Surface::makeShared<PerigeeSurface>(unitXYZ)->type(),
41  //
43  Translation3 translation{0., 1., 2.};
44  auto pTransform = Transform3(translation);
45  BOOST_CHECK_EQUAL(Surface::makeShared<PerigeeSurface>(pTransform)->type(),
47  //
49  auto copiedPerigeeSurface =
50  Surface::makeShared<PerigeeSurface>(*perigeeSurfaceObject);
51  BOOST_CHECK_EQUAL(copiedPerigeeSurface->type(), Surface::Perigee);
52  BOOST_CHECK(*copiedPerigeeSurface == *perigeeSurfaceObject);
53  //
55  auto copiedTransformedPerigeeSurface = Surface::makeShared<PerigeeSurface>(
56  tgContext, *perigeeSurfaceObject, pTransform);
57  BOOST_CHECK_EQUAL(copiedTransformedPerigeeSurface->type(), Surface::Perigee);
58 }
59 //
61 BOOST_AUTO_TEST_CASE(PerigeeSurfaceProperties) {
63  Vector3 unitXYZ{1., 1., 1.};
64  auto perigeeSurfaceObject = Surface::makeShared<PerigeeSurface>(unitXYZ);
65  //
67  BOOST_CHECK_EQUAL(perigeeSurfaceObject->type(), Surface::Perigee);
68  //
70  BOOST_CHECK_EQUAL(perigeeSurfaceObject->name(),
71  std::string("Acts::PerigeeSurface"));
72  //
74  boost::test_tools::output_test_stream dumpOuput;
75  perigeeSurfaceObject->toStream(tgContext, dumpOuput);
76  BOOST_CHECK(
77  dumpOuput.is_equal("Acts::PerigeeSurface:\n\
78  Center position (x, y, z) = (1.0000000, 1.0000000, 1.0000000)"));
79 }
80 
81 BOOST_AUTO_TEST_CASE(EqualityOperators) {
82  Vector3 unitXYZ{1., 1., 1.};
83  Vector3 invalidPosition{0.0, 0.0, 0.0};
84  auto perigeeSurfaceObject = Surface::makeShared<PerigeeSurface>(unitXYZ);
85  auto perigeeSurfaceObject2 = Surface::makeShared<PerigeeSurface>(unitXYZ);
86  auto assignedPerigeeSurface =
87  Surface::makeShared<PerigeeSurface>(invalidPosition);
89  BOOST_CHECK(*perigeeSurfaceObject == *perigeeSurfaceObject2);
91  *assignedPerigeeSurface = *perigeeSurfaceObject;
93  BOOST_CHECK(*assignedPerigeeSurface == *perigeeSurfaceObject);
94 }
95 
96 BOOST_AUTO_TEST_SUITE_END()
97 
98 } // namespace Test
99 
100 } // namespace Acts