9 #include <boost/test/unit_test.hpp>
23 #include <nlohmann/json.hpp>
26 namespace Experimental {
27 class DetectorVolume {};
33 BOOST_AUTO_TEST_SUITE(PortalJsonConverter)
38 auto surface = Acts::Surface::makeShared<Acts::PlaneSurface>(
43 BOOST_CHECK_NE(portal,
nullptr);
47 out.open(
"portal.json");
48 out << jPortal.dump(4);
54 BOOST_CHECK(
in.good());
55 nlohmann::json jPortalIn;
61 BOOST_CHECK_NE(portalIn,
nullptr);
67 auto forwardVolume = std::make_shared<Acts::Experimental::DetectorVolume>();
68 auto backwardVolume = std::make_shared<Acts::Experimental::DetectorVolume>();
70 auto surface = Acts::Surface::makeShared<Acts::PlaneSurface>(
74 BOOST_CHECK_NE(portal,
nullptr);
81 std::vector<const Acts::Experimental::DetectorVolume*>
detectorVolumes = {
82 forwardVolume.get(), backwardVolume.get()};
89 out.open(
"portal-single-connected.json");
90 out << jPortal.dump(4);
94 auto in = std::ifstream(
"portal-single-connected.json",
96 BOOST_CHECK(
in.good());
97 nlohmann::json jPortalIn;
102 tContext, jPortalIn, {forwardVolume, backwardVolume});
103 BOOST_CHECK_NE(portalIn,
nullptr);
109 auto forwardVolumeA = std::make_shared<Acts::Experimental::DetectorVolume>();
110 auto forwardVolumeB = std::make_shared<Acts::Experimental::DetectorVolume>();
111 auto forwardVolumeC = std::make_shared<Acts::Experimental::DetectorVolume>();
113 auto backwardVolume = std::make_shared<Acts::Experimental::DetectorVolume>();
115 auto surface = Acts::Surface::makeShared<Acts::PlaneSurface>(
119 BOOST_CHECK_NE(portal,
nullptr);
126 tContext, *portal, {forwardVolumeA, forwardVolumeB, forwardVolumeC},
129 std::vector<const Acts::Experimental::DetectorVolume*>
detectorVolumes = {
130 forwardVolumeA.get(), forwardVolumeB.get(), forwardVolumeC.get(),
131 backwardVolume.get()};
136 out.open(
"portal-multi-connected.json");
137 out << jPortal.dump(4);
141 BOOST_AUTO_TEST_SUITE_END()