10 #define BOOST_TEST_MODULE (return table values from fcl) 12 #include "boost/test/unit_test.hpp" 27 using namespace fhicl;
33 constexpr
auto tolerance = std::numeric_limits<double>::epsilon();
43 : i_(i), sj_(sj), sk_(sk), tl_(tl), str_(str), flag_(flag)
54 std::ostream&
operator<< [[maybe_unused]](std::ostream& os, RefS
const& refs)
56 os <<
" Atom: " << refs.i_ <<
" Sequence: [ " << refs.sj_ <<
", " 58 <<
" Tuple: [ " << refs.tl_ <<
", " << refs.str_ <<
", " 59 << std::boolalpha << refs.flag_ <<
" ]";
71 return this->atom() == refs.i_ && this->sequence(0) == refs.sj_ &&
72 this->sequence(1) == refs.sk_ &&
73 this->tuple.get<0>() == refs.tl_ &&
74 this->tuple.get<1>() == refs.str_ &&
75 this->tuple.get<2>() == refs.flag_;
79 std::ostream&
operator<< [[maybe_unused]](std::ostream& os,
S const&
s)
81 os <<
" Atom: " <<
s.atom() <<
" Sequence: [ " <<
s.sequence(0) <<
", " 82 <<
s.sequence(1) <<
" ]" 83 <<
" Tuple: [ " <<
s.tuple.get<0>() <<
", " <<
s.tuple.get<1>() <<
", " 84 << std::boolalpha <<
s.tuple.get<2>() <<
" ]";
94 Name(
"tupWithVecTable")};
96 Name(
"tupWithArrTable")};
98 Name(
"vecWithTupTable")};
100 Name(
"arrWithTupTable")};
105 Fixture() : FixtureBase(
"return_table_values_from_fcl_t.fcl") {}
110 BOOST_FIXTURE_TEST_SUITE(values_from_fcl, Fixture)
115 RefS ref(4, 3, 6, 8,
"something",
false);
116 BOOST_TEST(
config().table() == ref);
122 auto ref = {RefS{0, 10, 100, 0,
"something0",
true}};
123 auto it = ref.begin();
125 for (
auto const& table :
config().vecOfTable())
126 BOOST_TEST(table == *it++);
132 auto ref = {RefS{0, 10, 100, 0,
"array0",
true},
133 RefS{1, 11, 101, 1,
"array1",
true}};
135 auto it = ref.begin();
137 for (
auto const& table :
config().arrOfTable())
138 BOOST_TEST(table == *it++);
144 RefS ref{3, 13, 103, 3,
"tup0",
true};
145 BOOST_TEST(
config().tupWithTable.get<0>() == ref);
146 BOOST_TEST(
config().tupWithTable.get<1>() == 981);
153 auto ref = {RefS{4, 14, 104, 4,
"tup0",
true}};
154 auto it = ref.begin();
155 for (
auto const& table :
config().tupWithVecTable.get<0>())
156 BOOST_TEST(table == *it++);
157 BOOST_TEST(
config().tupWithVecTable.get<1>() == 345);
164 auto ref = {RefS{5, 15, 105, 5,
"tup0",
true},
165 RefS{6, 16, 106, 6,
"tup1",
true}};
166 auto it = ref.begin();
168 for (
auto const& table :
config().tupWithArrTable.get<0>())
169 BOOST_TEST(table == *it++);
170 BOOST_TEST(
config().tupWithArrTable.get<1>() == 789);
177 auto ref = RefS{7, 17, 107, 7,
"tup0",
true};
179 for (
auto const& tup :
config().vecWithTupTable()) {
180 BOOST_TEST(std::get<0>(tup) == ref);
181 BOOST_TEST(std::get<1>(tup) == 4);
182 BOOST_TEST(std::get<2>(tup) == 1.0004,
tolerance);
189 auto ref_ts = {RefS{8, 18, 108, 8,
"tup0",
true},
190 RefS{9, 19, 109, 9,
"tup1",
true}};
191 auto ref_is = {4, 40};
192 auto ref_ds = {0.89881, 1.47412};
194 auto it_ts = ref_ts.begin();
195 auto it_is = ref_is.begin();
196 auto it_ds = ref_ds.begin();
198 for (
auto const& tup :
config().arrWithTupTable()) {
199 BOOST_TEST(std::get<0>(tup) == *it_ts++);
200 BOOST_TEST(std::get<1>(tup) == *it_is++);
201 BOOST_TEST(std::get<2>(tup) == *it_ds++,
tolerance);
208 auto ref = RefS{10, 20, 200, 10,
"tup",
false};
209 BOOST_TEST(
config().tFragment() == ref);
212 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(table_t)
ChannelGroupService::Name Name
bool operator==(ModuleKeyAndType const &a, ModuleKeyAndType const &b) noexcept