Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:59

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include <boost/test/unit_test.hpp>
0010 
0011 #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0012 #include "Acts/Utilities/detail/RealQuadraticEquation.hpp"
0013 
0014 using Acts::detail::RealQuadraticEquation;
0015 
0016 namespace Acts::Test {
0017 
0018 BOOST_AUTO_TEST_SUITE(Surfaces)
0019 /// Unit test for creating RealQuadraticEquation object
0020 BOOST_AUTO_TEST_CASE(RealQuadraticEquationConstruction) {
0021   double a(1.0), b(-3.), c(2.);
0022   // test default construction: not deleted, not written
0023   // RealQuadraticEquation defaultConstructedRealQuadraticEquation;
0024   //
0025   /// Test construction with parameters
0026   BOOST_REQUIRE_NO_THROW(RealQuadraticEquation(a, b, c));
0027   //
0028   /// Copy constructor (implicit), void removes 'unused' compiler warning
0029   RealQuadraticEquation orig(a, b, c);
0030   BOOST_REQUIRE_NO_THROW(RealQuadraticEquation copied(orig); (void)copied);
0031 }
0032 /// Unit test for RealQuadraticEquation properties
0033 BOOST_AUTO_TEST_CASE(RealQuadraticEquationProperties) {
0034   double a(1.0), b(-3.), c(2.);
0035   //
0036   /// Test construction with parameters
0037   RealQuadraticEquation equation(a, b, c);
0038   //
0039   /// Test for solutions
0040   CHECK_CLOSE_REL(equation.first, 2., 1e-6);
0041   CHECK_CLOSE_REL(equation.second, 1., 1e-6);
0042   BOOST_CHECK_EQUAL(equation.solutions, 2);
0043 }
0044 
0045 /// Unit test for testing RealQuadraticEquation assignment
0046 BOOST_AUTO_TEST_CASE(RealQuadraticEquationAssignment) {
0047   double a(1.0), b(-3.), c(2.);
0048   RealQuadraticEquation realQuadraticEquationObject(a, b, c);
0049   // operator == not implemented in this class
0050   //
0051   /// Test assignment (implicit)
0052   RealQuadraticEquation assignedRealQuadraticEquationObject(9., -3.5, 6.7);
0053   assignedRealQuadraticEquationObject = realQuadraticEquationObject;
0054   CHECK_CLOSE_REL(assignedRealQuadraticEquationObject.first, 2., 1e-6);
0055   CHECK_CLOSE_REL(assignedRealQuadraticEquationObject.second, 1., 1e-6);
0056   BOOST_CHECK_EQUAL(assignedRealQuadraticEquationObject.solutions, 2);
0057   /// equality not written and not implicit
0058   // BOOST_CHECK_EQUAL(assignedRealQuadraticEquationObject,
0059   //                   realQuadraticEquationObject);
0060 }
0061 BOOST_AUTO_TEST_SUITE_END()
0062 
0063 }  // namespace Acts::Test