EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NavigationLayerTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file NavigationLayerTests.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 
19 
20 #include "LayerStub.hpp"
21 
22 using boost::test_tools::output_test_stream;
23 namespace utf = boost::unit_test;
24 
25 namespace Acts {
26 
27 namespace Test {
28 
29 // Create a test context
31 
32 namespace Layers {
33 BOOST_AUTO_TEST_SUITE(Layers)
34 
35 
36 BOOST_AUTO_TEST_CASE(NavigationLayerConstruction) {
37  // default constructor, copy and assignment are all deleted
38  std::shared_ptr<const Surface> pSurface = Surface::makeShared<SurfaceStub>();
39  auto pNavigationLayer = NavigationLayer::create(std::move(pSurface));
40  BOOST_CHECK_EQUAL(pNavigationLayer->layerType(), LayerType::navigation);
41  // next level: with thickness
42  const double thickness = 0.1;
43  auto pSurface2 = Surface::makeShared<SurfaceStub>();
44  auto pThickNavigationLayer =
45  NavigationLayer::create(std::move(pSurface2), thickness);
46  BOOST_CHECK_EQUAL(pThickNavigationLayer->layerType(), LayerType::navigation);
47 }
48 
50 BOOST_AUTO_TEST_CASE(NavigationLayerProperties, *utf::expected_failures(1)) {
51  const double thickness = 0.1;
52  std::shared_ptr<const Surface> pSurface = Surface::makeShared<SurfaceStub>();
53  auto rawSurfacePtr = pSurface.get();
54  auto pNavigationLayer =
55  NavigationLayer::create(std::move(pSurface), thickness);
57  Vector3D origin{0., 0., 0.};
58  // binningPosition(), needs a better test
59  BOOST_CHECK_EQUAL(pNavigationLayer->binningPosition(tgContext, b), origin);
60  // surfaceRepresentation() [looks dangerous]
61  BOOST_CHECK_EQUAL(rawSurfacePtr,
62  &(pNavigationLayer->surfaceRepresentation()));
63  // isOnLayer()
64  BOOST_CHECK(pNavigationLayer->isOnLayer(tgContext, origin, true));
65  // isOnLayer()
66  Vector3D crazyPosition{1000., 10000., std::nan("")};
67  BOOST_CHECK(!pNavigationLayer->isOnLayer(tgContext, crazyPosition, true));
68  // resolve()
69  BOOST_CHECK(!pNavigationLayer->resolve(true, true, true));
70 }
71 
72 BOOST_AUTO_TEST_SUITE_END()
73 } // namespace Layers
74 } // namespace Test
75 
76 } // namespace Acts