11 #define BOOST_TEST_MODULE ( intervals_fhicl_test ) 12 #include <boost/test/unit_test.hpp> 25 #include <type_traits> 29 template <
typename Config>
34 std::cout <<
"===> FHiCL configuration:";
35 if (pset.
is_empty()) std::cout <<
" <empty>";
38 validatedConfig.print_allowed_configuration
39 (std::cout <<
"===> Expected configuration: ");
42 validatedConfig.validate_ParameterSet(pset);
43 return validatedConfig();
48 template <
typename Config>
63 auto t = util::quantities::makeInterval<microseconds>(
"-7e1 ms"sv);
65 BOOST_TEST(
t == -70000_us);
66 BOOST_TEST(
t == -70_ms);
68 t = util::quantities::makeInterval<microseconds>(
"7e1ms"sv);
69 BOOST_TEST(
t == 70000_us);
70 BOOST_TEST(
t == 70_ms);
72 t = util::quantities::makeInterval<microseconds>(
"7e1"sv,
true);
73 BOOST_TEST(
t == 70_us);
76 util::quantities::makeInterval<microseconds>(
"7e1"sv),
81 util::quantities::makeInterval<microseconds>(
"7g ms"sv),
86 util::quantities::makeInterval<microseconds>(
"g7 ms"sv),
91 util::quantities::makeInterval<microseconds>(
""sv),
96 util::quantities::makeInterval<microseconds>(
""sv,
true),
110 auto t = util::quantities::makePoint<microsecond>(
"-7e1 ms"sv);
111 static_assert(std::is_same_v<decltype(
t),
microsecond>);
112 BOOST_TEST(
t == -70000_us);
113 BOOST_TEST(
t == -70_ms);
115 t = util::quantities::makePoint<microsecond>(
"7e1ms"sv);
116 BOOST_TEST(
t == 70000_us);
117 BOOST_TEST(
t == 70_ms);
119 t = util::quantities::makePoint<microsecond>(
"7e1"sv,
true);
120 BOOST_TEST(
t == 70_us);
123 util::quantities::makePoint<microsecond>(
"7e1"sv),
128 util::quantities::makePoint<microsecond>(
"7g ms"sv),
133 util::quantities::makePoint<microsecond>(
"g7 ms"sv),
138 util::quantities::makePoint<microsecond>(
""sv),
143 util::quantities::makePoint<microsecond>(
""sv,
true),
168 std::string const configStr {
"start: 2ms duration: 16ms" };
173 auto validatedConfig = validateConfig<Config>(configStr);
174 BOOST_TEST(validatedConfig.start() == expectedStart);
175 BOOST_TEST(validatedConfig.end() == expectedEnd);
176 BOOST_TEST(validatedConfig.duration() == expectedDuration);
203 pset.
put(
"start", expectedStart);
204 pset.
put(
"duration", expectedDuration);
206 auto validatedConfig = validateConfig<Config>(pset);
207 BOOST_TEST(validatedConfig.start() == expectedStart);
208 BOOST_TEST(validatedConfig.end() == expectedEnd);
209 BOOST_TEST(validatedConfig.duration() == expectedDuration);
215 BOOST_AUTO_TEST_SUITE(intervals_fhicl_test)
233 BOOST_AUTO_TEST_SUITE_END()
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
BOOST_AUTO_TEST_CASE(intervals_testcase)
static ParameterSet make(intermediate_table const &tbl)
microseconds_as<> microseconds
Type of time interval stored in microseconds, in double precision.
microsecond_as<> microsecond
Type of time stored in microseconds, in double precision.
ChannelGroupService::Name Name
Config validateConfig(fhicl::ParameterSet const &pset)
microsecond microseconds
Alias for common language habits.
typename config_impl< T >::type Config
microsecond_as<> microsecond
Type of time point stored in microseconds, in double precision.
std::string to_indented_string() const
An interval (duration, length, distance) between two quantity points.
Literal constants for time quantities.
Utilities to read interval and point quantity FHiCL configuration.
String representing a quantity has no unit.
Dimensioned variables representing space or time quantities.
String representing a quantity has an invalid number.
void put(std::string const &key)
QTextStream & endl(QTextStream &s)