Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:25:35

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/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/Extent.hpp"
0013 #include "Acts/Utilities/BinningType.hpp"
0014 #include "ActsPlugins/Json/ExtentJsonConverter.hpp"
0015 #include "ActsTests/CommonHelpers/FloatComparisons.hpp"
0016 
0017 #include <nlohmann/json.hpp>
0018 
0019 using namespace Acts;
0020 
0021 namespace ActsTests {
0022 
0023 BOOST_AUTO_TEST_SUITE(JsonSuite)
0024 
0025 BOOST_AUTO_TEST_CASE(ExtentRoundtripTests) {
0026   Extent e;
0027   e.set(AxisDirection::AxisR, 0, 200);
0028   e.set(AxisDirection::AxisZ, -50, 50);
0029 
0030   nlohmann::json j;
0031   j["extent"] = e;
0032 
0033   std::cout << j.dump(2) << std::endl;
0034 
0035   Extent eIn = j["extent"];
0036 
0037   CHECK_CLOSE_ABS(eIn.min(AxisDirection::AxisR), e.min(AxisDirection::AxisR),
0038                   10e-5);
0039   CHECK_CLOSE_ABS(eIn.max(AxisDirection::AxisR), e.max(AxisDirection::AxisR),
0040                   10e-5);
0041   CHECK_CLOSE_ABS(eIn.min(AxisDirection::AxisZ), e.min(AxisDirection::AxisZ),
0042                   10e-5);
0043   CHECK_CLOSE_ABS(eIn.max(AxisDirection::AxisZ), e.max(AxisDirection::AxisZ),
0044                   10e-5);
0045 }
0046 
0047 BOOST_AUTO_TEST_SUITE_END()
0048 
0049 }  // namespace ActsTests