9 #include <boost/test/unit_test.hpp>
20 #include <initializer_list>
25 #include <nlohmann/json.hpp>
31 BOOST_AUTO_TEST_SUITE(UtilitiesJsonConverter)
39 nlohmann::json joneDimOut;
41 out.open(
"BinUtility_1D.json");
42 out << joneDimOut.dump(2);
45 auto in = std::ifstream(
"BinUtility_1D.json",
47 BOOST_CHECK(
in.good());
48 nlohmann::json joneDimIn;
55 BOOST_CHECK(
isEqual(reference, test, 0.0001));
59 nlohmann::json jtwoDimOut;
61 out.open(
"BinUtility_2D.json");
62 out << jtwoDimOut.dump(2);
65 in = std::ifstream(
"BinUtility_2D.json",
67 BOOST_CHECK(
in.good());
68 nlohmann::json jtwoDimIn;
75 BOOST_CHECK(
isEqual(reference, test, 0.0001));
78 std::vector<float> boundaries = {-4., -1.5, 0., 10.};
80 nlohmann::json jthreeDimOut;
81 to_json(jthreeDimOut, reference);
82 out.open(
"BinUtility_3D.json");
83 out << jthreeDimOut.dump(2);
86 in = std::ifstream(
"BinUtility_3D.json",
88 BOOST_CHECK(
in.good());
89 nlohmann::json jthreeDimIn;
96 BOOST_CHECK(
isEqual(reference, test, 0.0001));
100 t = Eigen::AngleAxis(0.12334,
Vector3(1., 2., 3).normalized());
101 t.pretranslate(
Vector3(1., 2., 3.));
107 nlohmann::json jtransformOut;
108 to_json(jtransformOut, reference);
109 out.open(
"BinUtility_Transform.json");
110 out << jtransformOut.dump(2);
113 in = std::ifstream(
"BinUtility_Transform.json",
115 BOOST_CHECK(
in.good());
116 nlohmann::json jtransformIn;
123 BOOST_CHECK(
isEqual(reference, test, 0.0001));
129 nlohmann::json jrange;
138 BOOST_AUTO_TEST_SUITE_END()