#include "boost/test/unit_test.hpp"
#include "canvas/Persistency/Provenance/RangeSet.h"
#include "canvas/Persistency/Provenance/RunID.h"
#include <iostream>
#include <string>
Go to the source code of this file.
#define BOOST_TEST_MODULE (RangeSet_t) |
BOOST_AUTO_TEST_CASE |
( |
empty1 |
| ) |
|
Definition at line 16 of file RangeSet_t.cc.
19 BOOST_TEST(
rs.empty());
20 BOOST_TEST(
rs.has_disjoint_ranges());
21 BOOST_TEST(
rs.is_sorted());
BOOST_AUTO_TEST_CASE |
( |
empty2 |
| ) |
|
Definition at line 24 of file RangeSet_t.cc.
std::enable_if_t< detail::are_handles< T, U >::value, bool > disjoint_ranges(T const &a, U const &b)
BOOST_AUTO_TEST_CASE |
( |
empty3 |
| ) |
|
Definition at line 31 of file RangeSet_t.cc.
34 rs.emplace_range(1, 2, 2);
35 rs.emplace_range(1, 7, 7);
36 rs.emplace_range(1, 7, 7);
37 BOOST_TEST(
rs.empty());
BOOST_AUTO_TEST_CASE |
( |
fullRun1 |
| ) |
|
Definition at line 40 of file RangeSet_t.cc.
42 auto rs = RangeSet::forRun(
RunID{72});
43 BOOST_TEST(!
rs.empty());
44 BOOST_TEST(
rs.has_disjoint_ranges());
45 BOOST_TEST(
rs.is_valid());
46 BOOST_TEST(
rs.is_sorted());
47 BOOST_TEST(
rs.is_collapsed());
48 BOOST_TEST(
rs.is_full_run());
49 std::ostringstream oss;
51 BOOST_TEST(oss.str() ==
" Run: 72 (full run)"s);
BOOST_AUTO_TEST_CASE |
( |
fullRun2 |
| ) |
|
Definition at line 54 of file RangeSet_t.cc.
56 auto const rs1 = RangeSet::forRun(
RunID{1});
57 auto const rs2 = RangeSet::forRun(
RunID{2});
59 BOOST_TEST(rs1.is_full_run());
60 BOOST_TEST(rs2.is_full_run());
61 BOOST_TEST(rs1.has_disjoint_ranges());
62 BOOST_TEST(rs2.has_disjoint_ranges());
std::enable_if_t< detail::are_handles< T, U >::value, bool > disjoint_ranges(T const &a, U const &b)
BOOST_AUTO_TEST_CASE |
( |
fullRun3 |
| ) |
|
Definition at line 66 of file RangeSet_t.cc.
70 auto const rs2 = RangeSet::forRun(
RunID{1});
72 BOOST_TEST(!rs1.is_full_run());
73 BOOST_TEST(rs2.is_full_run());
74 BOOST_TEST(rs1.has_disjoint_ranges());
75 BOOST_TEST(rs2.has_disjoint_ranges());
std::enable_if_t< detail::are_handles< T, U >::value, bool > disjoint_ranges(T const &a, U const &b)
void emplace_range(ARGS &&...)
BOOST_AUTO_TEST_CASE |
( |
fullRun4 |
| ) |
|
Definition at line 79 of file RangeSet_t.cc.
85 auto const rs2 = RangeSet::forRun(
RunID{1});
86 BOOST_TEST(rs1 == rs2);
EventRange full_run_event_range()
BOOST_AUTO_TEST_CASE |
( |
disjoint1 |
| ) |
|
Definition at line 89 of file RangeSet_t.cc.
92 rs.emplace_range(1, 2, 7);
93 rs.emplace_range(1, 9, 14);
94 BOOST_TEST(
rs.has_disjoint_ranges());
95 BOOST_TEST(
rs.is_sorted());
96 BOOST_TEST(!
rs.is_full_run());
BOOST_AUTO_TEST_CASE |
( |
disjoint2 |
| ) |
|
Definition at line 99 of file RangeSet_t.cc.
103 rs1.emplace_range(1, 9, 14);
104 rs1.emplace_range(3, 1, 8);
105 rs1.emplace_range(4, 5, 8);
106 BOOST_TEST(rs1.has_disjoint_ranges());
107 BOOST_TEST(rs1.is_sorted());
111 rs2.emplace_range(1, 14, 101);
112 rs2.emplace_range(2, 14, 101);
113 rs2.emplace_range(4, 1, 5);
114 BOOST_TEST(rs2.has_disjoint_ranges());
115 BOOST_TEST(rs2.is_sorted());
std::enable_if_t< detail::are_handles< T, U >::value, bool > disjoint_ranges(T const &a, U const &b)
void emplace_range(ARGS &&...)
BOOST_AUTO_TEST_CASE |
( |
collapsing1 |
| ) |
|
Definition at line 120 of file RangeSet_t.cc.
123 rs.emplace_range(1, 1, 4);
124 rs.emplace_range(1, 4, 6);
125 rs.emplace_range(1, 6, 11);
126 rs.emplace_range(1, 11, 101);
127 BOOST_TEST(
rs.ranges().size() == 4u);
129 BOOST_TEST(
rs.ranges().size() == 1u);
130 BOOST_TEST(
rs.front().begin() == 1u);
131 BOOST_TEST(
rs.front().end() == 101u);
132 BOOST_TEST(
rs.has_disjoint_ranges());
BOOST_AUTO_TEST_CASE |
( |
collapsing2 |
| ) |
|
Definition at line 135 of file RangeSet_t.cc.
138 rs.emplace_range(1, 1, 4);
139 rs.emplace_range(1, 1, 11);
140 rs.emplace_range(1, 4, 11);
141 BOOST_TEST(
rs.is_sorted());
142 BOOST_CHECK_EXCEPTION(
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
BOOST_AUTO_TEST_CASE |
( |
splitting1 |
| ) |
|
Definition at line 148 of file RangeSet_t.cc.
151 rs.emplace_range(1, 2, 7);
152 rs.emplace_range(1, 9, 14);
153 rs.split_range(1, 4);
156 ref.emplace_range(1, 4, 7);
157 ref.emplace_range(1, 9, 14);
158 BOOST_TEST(
rs == ref);
void emplace_range(ARGS &&...)
BOOST_AUTO_TEST_CASE |
( |
splitting2 |
| ) |
|
Definition at line 161 of file RangeSet_t.cc.
164 rs.emplace_range(1, 2, 7);
165 rs.emplace_range(1, 9, 14);
167 rs.split_range(1, 7);
169 rs.split_range(2, 7);
170 BOOST_TEST(split_range1.first ==
rs.end_idx());
171 BOOST_TEST(split_range2.first ==
rs.end_idx());
172 BOOST_TEST(!split_range1.second);
173 BOOST_TEST(!split_range2.second);
BOOST_AUTO_TEST_CASE |
( |
splitting3 |
| ) |
|
Definition at line 176 of file RangeSet_t.cc.
179 rs.emplace_range(1, 2, 3);
180 auto split_range1 =
rs.split_range(1, 2);
181 auto split_range2 =
rs.split_range(1, 3);
182 BOOST_TEST(split_range1.first ==
rs.end_idx());
183 BOOST_TEST(split_range2.first ==
185 BOOST_TEST(!split_range1.second);
186 BOOST_TEST(!split_range2.second);
BOOST_AUTO_TEST_CASE |
( |
assigning |
| ) |
|
Definition at line 189 of file RangeSet_t.cc.
192 rs.emplace_range(1, 2, 7);
193 rs.emplace_range(1, 9, 14);
194 rs.split_range(1, 4);
197 BOOST_TEST(
rs == ref);
void assign_ranges(RangeSet const &rs, std::size_t const b, std::size_t const e)
BOOST_AUTO_TEST_CASE |
( |
merging1 |
| ) |
|
Definition at line 200 of file RangeSet_t.cc.
205 rs1.emplace_range(1, 4, 8);
212 rs2.emplace_range(1, 8, 11);
218 BOOST_TEST(rs1.ranges().size() == 1u);
219 BOOST_TEST(rs1.front().begin() == 1u);
220 BOOST_TEST(rs1.front().end() == 11u);
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
void emplace_range(ARGS &&...)
BOOST_AUTO_TEST_CASE |
( |
merging2 |
| ) |
|
Definition at line 223 of file RangeSet_t.cc.
228 rs1.emplace_range(1, 4, 8);
239 BOOST_CHECK_EXCEPTION(
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
std::enable_if_t< detail::are_handles< T, U >::value, bool > disjoint_ranges(T const &a, U const &b)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
void emplace_range(ARGS &&...)
BOOST_AUTO_TEST_CASE |
( |
merging3 |
| ) |
|
Definition at line 245 of file RangeSet_t.cc.
250 rs1.emplace_range(1, 4, 8);
263 std::vector<EventRange>
const ref_ranges{
268 BOOST_TEST(rs1 == ref);
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
std::enable_if_t< detail::are_handles< T, U >::value, bool > disjoint_ranges(T const &a, U const &b)
void emplace_range(ARGS &&...)
BOOST_AUTO_TEST_CASE |
( |
merging4 |
| ) |
|
Definition at line 271 of file RangeSet_t.cc.
277 auto const ref = rs1;
286 BOOST_TEST(rs1 == ref);
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
std::enable_if_t< detail::are_handles< T, U >::value, bool > disjoint_ranges(T const &a, U const &b)
void emplace_range(ARGS &&...)
BOOST_AUTO_TEST_CASE |
( |
merging5 |
| ) |
|
Definition at line 289 of file RangeSet_t.cc.
292 auto rs1 = RangeSet::forRun(
RunID{2});
293 auto const ref = rs1;
302 BOOST_TEST(rs1 == ref);
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
std::enable_if_t< detail::are_handles< T, U >::value, bool > disjoint_ranges(T const &a, U const &b)
BOOST_AUTO_TEST_CASE |
( |
merging6 |
| ) |
|
Definition at line 305 of file RangeSet_t.cc.
310 rs1.emplace_range(1, 2, 2);
311 rs1.emplace_range(1, 2, 2);
315 BOOST_TEST(rs1 == rs2);
319 BOOST_TEST(rs1 == rs2);
void emplace_range(ARGS &&...)
BOOST_AUTO_TEST_CASE |
( |
overlapping_ranges |
| ) |
|
Definition at line 322 of file RangeSet_t.cc.
326 rs1.emplace_range(1, 4, 8);
327 rs1.emplace_range(2, 3, 17);
332 rs2.emplace_range(2, 7, 9);
std::enable_if_t< detail::are_handles< T, U >::value, bool > overlapping_ranges(T const &a, U const &b)
void emplace_range(ARGS &&...)
BOOST_AUTO_TEST_CASE |
( |
invalid |
| ) |
|
Definition at line 339 of file RangeSet_t.cc.
341 auto const rs1 = RangeSet::invalid();
342 auto const rs2 = RangeSet::invalid();
std::enable_if_t< detail::are_handles< T, U >::value, bool > disjoint_ranges(T const &a, U const &b)
std::enable_if_t< detail::are_handles< T, U >::value, bool > overlapping_ranges(T const &a, U const &b)
std::enable_if_t< detail::are_handles< T, U >::value, bool > same_ranges(T const &a, U const &b)