3 #define BOOST_TEST_MODULE (OpenRangeSetHandler_t) 4 #include "boost/test/unit_test.hpp" 24 eventRanges(
unsigned const sr)
41 for (
unsigned sr{0}; sr != 3; ++
sr) {
47 vector<SimpleEvent>
events;
48 unique_ptr<RangeSetHandler> srHandler = make_unique<OpenRangeSetHandler>(1);
49 unique_ptr<RangeSetHandler> rHandler = make_unique<OpenRangeSetHandler>(1);
53 BOOST_FIXTURE_TEST_SUITE(OpenRangeSetHandler_t, RSHandler)
61 rHandler->update(
e.id,
e.lastInSubRun);
62 srHandler->update(
e.id,
e.lastInSubRun);
64 srHandler->flushRanges();
68 BOOST_TEST(srHandler->seenRanges() == subRunRS);
70 srHandler = make_unique<OpenRangeSetHandler>(1);
75 for (
unsigned sr{0};
sr != 3; ++
sr) {
79 BOOST_TEST(rHandler->seenRanges() == runRS);
85 for (std::size_t i{0}; i != 5; ++i) {
87 srHandler->update(
e.id,
e.lastInSubRun);
88 rHandler->update(
e.id,
e.lastInSubRun);
90 srHandler->flushRanges();
94 BOOST_TEST(srHandler->seenRanges() == subRunRS);
96 srHandler = make_unique<OpenRangeSetHandler>(1);
101 srHandler->maybeSplitRange();
102 rHandler->maybeSplitRange();
104 vector<EventRange> runRanges{
EventRange{0, 1, 4}};
105 vector<EventRange> subRunRanges{
EventRange{1, 1, 3}};
107 RangeSet const subRunRS{1, subRunRanges};
109 BOOST_TEST(srHandler->seenRanges() == subRunRS);
110 BOOST_TEST(rHandler->seenRanges() == runRS);
118 srHandler->update(
e.id,
e.lastInSubRun);
119 rHandler->update(
e.id,
e.lastInSubRun);
120 srHandler->flushRanges();
124 BOOST_TEST(srHandler->seenRanges() == subRunRS);
126 srHandler = make_unique<OpenRangeSetHandler>(1);
128 for (std::size_t i{6}; i !=
events.size(); ++i) {
130 srHandler->update(
e.id,
e.lastInSubRun);
131 rHandler->update(
e.id,
e.lastInSubRun);
135 srHandler->flushRanges();
136 rHandler->flushRanges();
138 vector<EventRange> runRanges{
EventRange{1, 3, 4}};
139 vector<EventRange> subRunRanges{
EventRange{2, 1, 4}};
141 RangeSet const subRunRS{1, subRunRanges};
143 BOOST_TEST(srHandler->seenRanges() == subRunRS);
144 BOOST_TEST(rHandler->seenRanges() == runRS);
151 for (std::size_t i{0}; i != 6; ++i) {
153 srHandler->update(
e.id,
e.lastInSubRun);
154 rHandler->update(
e.id,
e.lastInSubRun);
155 if (
e.lastInSubRun) {
156 srHandler->flushRanges();
160 BOOST_TEST(srHandler->seenRanges() == subRunRS);
162 srHandler = make_unique<OpenRangeSetHandler>(1);
167 srHandler->maybeSplitRange();
168 rHandler->maybeSplitRange();
170 vector<EventRange> runRanges;
171 for (std::size_t i{0}; i != 2; ++i) {
174 RangeSet const subRunRS{1, std::vector<EventRange>{}};
176 BOOST_TEST(srHandler->seenRanges() == subRunRS);
177 BOOST_TEST(rHandler->seenRanges() == runRS);
182 for (std::size_t i{6}; i !=
events.size(); ++i) {
184 srHandler->update(
e.id,
e.lastInSubRun);
185 rHandler->update(
e.id,
e.lastInSubRun);
189 srHandler->flushRanges();
190 rHandler->flushRanges();
194 BOOST_TEST(srHandler->seenRanges() ==
rs);
195 BOOST_TEST(rHandler->seenRanges() ==
rs);
199 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(Simple)
std::string concatenate(H const &h, T const &...t)
static constexpr double sr
void emplace_range(ARGS &&...)