Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExtentJsonConverterTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ExtentJsonConverterTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2022 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/unit_test.hpp>
10 
12 #include "Acts/Geometry/Extent.hpp"
16 
17 #include <nlohmann/json.hpp>
18 
19 using namespace Acts;
20 
21 BOOST_AUTO_TEST_SUITE(ExtentJsonConverter)
22 
23 BOOST_AUTO_TEST_CASE(ExtentRoundtripTests) {
24  Extent e;
25  e.set(binR, 0, 200);
26  e.set(binZ, -50, 50);
27 
28  nlohmann::json j;
29  j["extent"] = e;
30 
31  Extent eIn = j["extent"];
32 
33  CHECK_CLOSE_ABS(eIn.min(binR), e.min(binR), 10e-5);
34  CHECK_CLOSE_ABS(eIn.max(binR), e.max(binR), 10e-5);
35  CHECK_CLOSE_ABS(eIn.min(binZ), e.min(binZ), 10e-5);
36  CHECK_CLOSE_ABS(eIn.max(binZ), e.max(binZ), 10e-5);
37 }
38 
39 BOOST_AUTO_TEST_SUITE_END()