ECCE @ EIC 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 
13 #include <limits>
14 
18 
20 
21 // namespace bdata = boost::unit_test::data;
22 namespace utf = boost::unit_test;
23 
24 namespace Acts {
25 
26 namespace Test {
27 BOOST_AUTO_TEST_SUITE(Surfaces)
29 BOOST_AUTO_TEST_CASE(RealQuadraticEquationConstruction) {
30  double a(1.0), b(-3.), c(2.);
31  // test default construction: not deleted, not written
32  // RealQuadraticEquation defaultConstructedRealQuadraticEquation;
33  //
35  BOOST_REQUIRE_NO_THROW(RealQuadraticEquation(a, b, c));
36  //
38  RealQuadraticEquation orig(a, b, c);
39  BOOST_REQUIRE_NO_THROW(RealQuadraticEquation copied(orig); (void)copied);
40 }
42 BOOST_AUTO_TEST_CASE(RealQuadraticEquationProperties) {
43  double a(1.0), b(-3.), c(2.);
44  //
46  RealQuadraticEquation equation(a, b, c);
47  //
49  CHECK_CLOSE_REL(equation.first, 2., 1e-6);
50  CHECK_CLOSE_REL(equation.second, 1., 1e-6);
51  BOOST_CHECK_EQUAL(equation.solutions, 2);
52 }
53 
55 BOOST_AUTO_TEST_CASE(RealQuadraticEquationAssignment) {
56  double a(1.0), b(-3.), c(2.);
57  RealQuadraticEquation realQuadraticEquationObject(a, b, c);
58  // operator == not implemented in this class
59  //
61  RealQuadraticEquation assignedRealQuadraticEquationObject(9., -3.5, 6.7);
62  assignedRealQuadraticEquationObject = realQuadraticEquationObject;
63  CHECK_CLOSE_REL(assignedRealQuadraticEquationObject.first, 2., 1e-6);
64  CHECK_CLOSE_REL(assignedRealQuadraticEquationObject.second, 1., 1e-6);
65  BOOST_CHECK_EQUAL(assignedRealQuadraticEquationObject.solutions, 2);
67  // BOOST_CHECK_EQUAL(assignedRealQuadraticEquationObject,
68  // realQuadraticEquationObject);
69 }
70 BOOST_AUTO_TEST_SUITE_END()
71 
72 } // namespace Test
73 
74 } // namespace Acts