EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
MaterialMapJsonConverterTests.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file MaterialMapJsonConverterTests.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2019-2020 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
11
#include "
Acts/Plugins/Json/JsonGeometryConverter.hpp
"
12
#include "
Acts/Tests/CommonHelpers/DataDirectory.hpp
"
13
14
#include <fstream>
15
16
BOOST_AUTO_TEST_SUITE(MaterialMapJsonConverter)
17
18
BOOST_AUTO_TEST_CASE
(RoundtripFromFile) {
19
// read reference map from file
20
std::ifstream refFile(
Acts::Test::getDataPath
(
"material-map.json"
));
21
nlohmann::json
refJson;
22
refFile >> refJson;
23
24
// convert to the material map and back again
25
Acts::JsonGeometryConverter::Config
converterCfg;
26
Acts::JsonGeometryConverter
converter
(converterCfg);
27
auto
materialMap = converter.
jsonToMaterialMaps
(refJson);
28
auto
encodedJson = converter.
materialMapsToJson
(materialMap);
29
30
// verify identical encoded JSON values
31
BOOST_CHECK_EQUAL(refJson, encodedJson);
32
}
33
34
BOOST_AUTO_TEST_SUITE_END()
acts
blob
sPHENIX
Tests
UnitTests
Plugins
Json
MaterialMapJsonConverterTests.cpp
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:28
using
1.8.2 with
EIC GitHub integration