File indexing completed on 2025-01-18 09:13:11
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/Extent.hpp"
0013 #include "Acts/Plugins/Json/ExtentJsonConverter.hpp"
0014 #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0015 #include "Acts/Utilities/BinningType.hpp"
0016
0017 #include <nlohmann/json.hpp>
0018
0019 using namespace Acts;
0020
0021 BOOST_AUTO_TEST_SUITE(ExtentJsonConverter)
0022
0023 BOOST_AUTO_TEST_CASE(ExtentRoundtripTests) {
0024 Extent e;
0025 e.set(AxisDirection::AxisR, 0, 200);
0026 e.set(AxisDirection::AxisZ, -50, 50);
0027
0028 nlohmann::json j;
0029 j["extent"] = e;
0030
0031 std::cout << j.dump(2) << std::endl;
0032
0033 Extent eIn = j["extent"];
0034
0035 CHECK_CLOSE_ABS(eIn.min(AxisDirection::AxisR), e.min(AxisDirection::AxisR),
0036 10e-5);
0037 CHECK_CLOSE_ABS(eIn.max(AxisDirection::AxisR), e.max(AxisDirection::AxisR),
0038 10e-5);
0039 CHECK_CLOSE_ABS(eIn.min(AxisDirection::AxisZ), e.min(AxisDirection::AxisZ),
0040 10e-5);
0041 CHECK_CLOSE_ABS(eIn.max(AxisDirection::AxisZ), e.max(AxisDirection::AxisZ),
0042 10e-5);
0043 }
0044
0045 BOOST_AUTO_TEST_SUITE_END()