1 #define BOOST_TEST_MODULE (intermediate_table_t) 2 #include "boost/test/unit_test.hpp" 10 using namespace fhicl;
12 BOOST_AUTO_TEST_SUITE(intermediate_table_t)
19 table.
put(
"string1",
"string");
21 table.
put(
"complex", std::complex<double>(-3, -0.5));
22 table.
put(
"sequence", std::vector<int>{5, 10, 15, 20, 25});
23 table.
put(
"double", 28.5);
24 table.
put(
"sequence[6]", 35);
25 table.
put(
"table.val1", 92);
26 table.
put(
"table.t1.val",
"oops");
27 BOOST_CHECK_NO_THROW(table.
erase(
"table.t1.waldo"));
28 BOOST_CHECK_NO_THROW(table.
erase(
"table.t1.val"));
29 BOOST_TEST(!table.
exists(
"table.t1.val"));
33 BOOST_TEST(table.
get<std::complex<double>>(
"complex") ==
34 std::complex<double>(-3, -0.5));
35 BOOST_TEST(table.
get<
sequence_t const&>(
"sequence").size() == 7u);
36 BOOST_TEST(table.
get<
int>(
"sequence[3]") == 20);
44 char const* cfg = R
"(BEGIN_PROLOG 45 w: { x: { y: { z: { a: 2 b: 3 } } } } 47 q: { @table::w.x.y })"; 49 BOOST_TEST(pset.has_key(
"q.z"));
50 BOOST_TEST(!pset.has_key(
"w"));
55 char const* cfg = R
"(BEGIN_PROLOG 56 w.x.y: { z: { a: 2 b: 3 } } 58 q: { @table::w.x.y })"; 60 BOOST_TEST(pset.has_key(
"q.z"));
61 BOOST_TEST(!pset.has_key(
"w"));
66 char const* cfg = R
"(BEGIN_PROLOG 71 BOOST_TEST(pset.has_key(
"w.b"));
72 BOOST_TEST(!pset.has_key(
"w.x"));
77 char const* cfg = R
"(BEGIN_PROLOG 82 BOOST_TEST(pset.has_key(
"w.b"));
83 BOOST_TEST(!pset.has_key(
"w.x"));
88 char const* cfg = R
"(BEGIN_PROLOG 93 BOOST_TEST(pset.has_key(
"w.b"));
94 BOOST_TEST(!pset.has_key(
"w.x"));
99 char const* cfg = R
"(BEGIN_PROLOG 104 BOOST_TEST(pset.has_key(
"w.b"));
105 BOOST_TEST(!pset.has_key(
"w.x"));
110 char const* cfg = R
"(BEGIN_PROLOG 113 w: { x: { c: 6 } })"; 115 BOOST_TEST(pset.has_key(
"w.x.c"));
116 BOOST_TEST(!pset.has_key(
"w.x.y"));
121 char const* cfg = R
"(BEGIN_PROLOG 126 BOOST_TEST(pset.has_key(
"w.x.c"));
127 BOOST_TEST(!pset.has_key(
"w.x.y"));
132 char const* cfg = R
"(BEGIN_PROLOG 135 w: { x: { c: 6 } })"; 137 BOOST_TEST(pset.has_key(
"w.x.c"));
138 BOOST_TEST(!pset.has_key(
"w.x.y"));
143 char const* cfg = R
"(BEGIN_PROLOG 148 BOOST_TEST(pset.has_key(
"w.x.c"));
149 BOOST_TEST(!pset.has_key(
"w.x.y"));
152 BOOST_AUTO_TEST_SUITE_END()
static ParameterSet make(intermediate_table const &tbl)
fhicl::extended_value::sequence_t sequence_t
cet::coded_exception< error, detail::translate > exception