Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RealQuadraticEquationTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RealQuadraticEquationTests.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 
15 
17 
18 // namespace bdata = boost::unit_test::data;
19 namespace utf = boost::unit_test;
20 
21 namespace Acts {
22 
23 namespace Test {
24 BOOST_AUTO_TEST_SUITE(Surfaces)
26 BOOST_AUTO_TEST_CASE(RealQuadraticEquationConstruction) {
27  double a(1.0), b(-3.), c(2.);
28  // test default construction: not deleted, not written
29  // RealQuadraticEquation defaultConstructedRealQuadraticEquation;
30  //
32  BOOST_REQUIRE_NO_THROW(RealQuadraticEquation(a, b, c));
33  //
35  RealQuadraticEquation orig(a, b, c);
36  BOOST_REQUIRE_NO_THROW(RealQuadraticEquation copied(orig); (void)copied);
37 }
39 BOOST_AUTO_TEST_CASE(RealQuadraticEquationProperties) {
40  double a(1.0), b(-3.), c(2.);
41  //
43  RealQuadraticEquation equation(a, b, c);
44  //
46  CHECK_CLOSE_REL(equation.first, 2., 1e-6);
47  CHECK_CLOSE_REL(equation.second, 1., 1e-6);
48  BOOST_CHECK_EQUAL(equation.solutions, 2);
49 }
50 
52 BOOST_AUTO_TEST_CASE(RealQuadraticEquationAssignment) {
53  double a(1.0), b(-3.), c(2.);
54  RealQuadraticEquation realQuadraticEquationObject(a, b, c);
55  // operator == not implemented in this class
56  //
58  RealQuadraticEquation assignedRealQuadraticEquationObject(9., -3.5, 6.7);
59  assignedRealQuadraticEquationObject = realQuadraticEquationObject;
60  CHECK_CLOSE_REL(assignedRealQuadraticEquationObject.first, 2., 1e-6);
61  CHECK_CLOSE_REL(assignedRealQuadraticEquationObject.second, 1., 1e-6);
62  BOOST_CHECK_EQUAL(assignedRealQuadraticEquationObject.solutions, 2);
64  // BOOST_CHECK_EQUAL(assignedRealQuadraticEquationObject,
65  // realQuadraticEquationObject);
66 }
67 BOOST_AUTO_TEST_SUITE_END()
68 
69 } // namespace Test
70 
71 } // namespace Acts