Namespaces | Macros | Functions
FileIndex_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "canvas/Persistency/Provenance/FileIndex.h"

Go to the source code of this file.

Namespaces

 art
 

Macros

#define BOOST_TEST_MODULE   (FileIndex_t)
 

Functions

std::ostream & art::boost_test_print_type (std::ostream &os, FileIndex::iterator it)
 
std::ostream & art::boost_test_print_type (std::ostream &os, FileIndex::const_iterator it)
 
 BOOST_AUTO_TEST_CASE (constructAndInsertTest)
 
 BOOST_AUTO_TEST_CASE (eventSortAndSearchTest)
 
 BOOST_AUTO_TEST_CASE (eventEntrySortAndSearchTest)
 
 BOOST_AUTO_TEST_CASE (eventsUniqueAndOrderedTest)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (FileIndex_t)

Definition at line 1 of file FileIndex_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( constructAndInsertTest  )

Definition at line 24 of file FileIndex_t.cc.

25 {
26  art::FileIndex fileIndex;
27  BOOST_TEST(fileIndex.empty());
28  BOOST_TEST(fileIndex.size() == 0);
29  BOOST_TEST(fileIndex.begin() == fileIndex.end());
30 
31  fileIndex.addEntry(EventID(100, 101, 102), 1);
32  fileIndex.addEntry(EventID::invalidEvent(SubRunID(200, 201)), 2);
33  fileIndex.addEntry(EventID(300, 0, 1), 3);
34  fileIndex.addEntry(EventID::invalidEvent(RunID(300)), 3);
35  fileIndex.addEntry(EventID(100, 101, 103), 3);
36 
37  BOOST_TEST(!fileIndex.empty());
38  BOOST_TEST(fileIndex.size() == 5);
39 
40  auto it = fileIndex.begin();
41  BOOST_TEST(it->eventID == EventID(100, 101, 102));
42  BOOST_TEST(it->entry == 1);
43  BOOST_TEST(it->getEntryType() == art::FileIndex::kEvent);
44 
45  ++it;
46  BOOST_TEST(it->getEntryType() == art::FileIndex::kSubRun);
47 
48  ++it;
49  BOOST_TEST(it->getEntryType() == art::FileIndex::kEvent);
50 
51  ++it;
52  BOOST_TEST(it->eventID == EventID::invalidEvent(RunID(300)));
53  BOOST_TEST(it->entry == 3);
54  BOOST_TEST(it->getEntryType() == art::FileIndex::kRun);
55 
56  ++it;
57  ++it;
58  BOOST_TEST(it == fileIndex.end());
59 
60  BOOST_TEST(fileIndex.allEventsInEntryOrder() == true);
61  BOOST_TEST(fileIndex.allEventsInEntryOrder() == true);
62 }
iterator begin()
Definition: FileIndex.cc:50
bool allEventsInEntryOrder() const
Definition: FileIndex.cc:165
bool empty() const
Definition: FileIndex.cc:92
std::vector< Element >::size_type size() const
Definition: FileIndex.cc:86
void addEntry(EventID const &eID, EntryNumber_t entry)
Definition: FileIndex.cc:134
iterator end()
Definition: FileIndex.cc:68
BOOST_AUTO_TEST_CASE ( eventSortAndSearchTest  )

Definition at line 64 of file FileIndex_t.cc.

65 {
66  // Note this contains some illegal duplicates. There is nothing to
67  // prevent these from occurring so we handle this using a
68  // stable_sort for now ... They will not bother the FileIndex.
69 
70  art::FileIndex fileIndex;
71  fileIndex.addEntry(EventID(3, 3, 2), 5);
72  fileIndex.addEntry(EventID(3, 3, 1), 4);
73  fileIndex.addEntry(EventID(3, 3, 3), 3);
74  fileIndex.addEntry(EventID::invalidEvent(SubRunID(3, 3)), 6);
75  fileIndex.addEntry(EventID::invalidEvent(RunID(3)), 7);
76  fileIndex.addEntry(EventID::invalidEvent(RunID(1)), 8);
77  fileIndex.addEntry(EventID::invalidEvent(SubRunID(3, 1)), 9);
78  fileIndex.addEntry(EventID::invalidEvent(RunID(3)), 1);
79  fileIndex.addEntry(EventID::invalidEvent(SubRunID(3, 3)), 1);
80  fileIndex.addEntry(EventID(3, 3, 1), 1);
81  fileIndex.addEntry(EventID(1, 2, 2), 2);
82  fileIndex.addEntry(EventID(1, 2, 4), 1);
83  fileIndex.addEntry(EventID::invalidEvent(SubRunID(1, 2)), 2);
84  fileIndex.addEntry(EventID(1, 2, 1), 2);
85  fileIndex.addEntry(EventID::invalidEvent(RunID(6)), 9);
86  fileIndex.addEntry(EventID::invalidEvent(RunID(9)), 10);
87  fileIndex.addEntry(EventID::invalidEvent(SubRunID(6, 1)), 10);
88  fileIndex.addEntry(EventID::invalidEvent(SubRunID(6, 3)), 11);
89  fileIndex.addEntry(EventID::invalidEvent(SubRunID(6, 4)), 12);
90  fileIndex.addEntry(EventID::invalidEvent(SubRunID(6, 5)), 13);
91  fileIndex.addEntry(EventID::invalidEvent(SubRunID(6, 8)), 14);
92  fileIndex.addEntry(EventID::invalidEvent(SubRunID(6, 9)), 15);
93  fileIndex.addEntry(EventID::invalidEvent(SubRunID(9, 1)), 16);
94  fileIndex.addEntry(EventID::invalidEvent(SubRunID(9, 2)), 17);
95  fileIndex.addEntry(EventID::invalidEvent(SubRunID(6, 0)), 9);
96  fileIndex.addEntry(EventID(6, 0, 4), 12);
97  fileIndex.addEntry(EventID(6, 1, 5), 13);
98  fileIndex.addEntry(EventID(6, 1, 6), 14);
99  fileIndex.addEntry(EventID(6, 1, 7), 15);
100  fileIndex.addEntry(EventID(6, 3, 9), 16);
101  fileIndex.addEntry(EventID(6, 5, 13), 17);
102  fileIndex.addEntry(EventID(6, 5, 14), 18);
103  fileIndex.addEntry(EventID(6, 8, 15), 19);
104  fileIndex.addEntry(EventID(6, 9, 5), 20);
105  fileIndex.addEntry(EventID(6, 9, 25), 21);
106  fileIndex.addEntry(EventID(6, 9, 25), 27);
107  fileIndex.addEntry(EventID(9, 1, 5), 22);
108  fileIndex.addEntry(EventID(9, 2, 5), 23);
109  fileIndex.sortBy_Run_SubRun_Event();
110 
111  art::FileIndex shouldBe;
112  shouldBe.addEntry(EventID::invalidEvent(RunID(1)), 8);
113  shouldBe.addEntry(EventID::invalidEvent(SubRunID(1, 2)), 2);
114  shouldBe.addEntry(EventID(1, 2, 1), 2);
115  shouldBe.addEntry(EventID(1, 2, 2), 2);
116  shouldBe.addEntry(EventID(1, 2, 4), 1);
117  shouldBe.addEntry(EventID::invalidEvent(RunID(3)), 7);
118  shouldBe.addEntry(EventID::invalidEvent(RunID(3)), 1);
119  shouldBe.addEntry(EventID::invalidEvent(SubRunID(3, 1)), 9);
120  shouldBe.addEntry(EventID::invalidEvent(SubRunID(3, 3)), 6);
121  shouldBe.addEntry(EventID::invalidEvent(SubRunID(3, 3)), 1);
122  shouldBe.addEntry(EventID(3, 3, 1), 4);
123  shouldBe.addEntry(EventID(3, 3, 1), 1);
124  shouldBe.addEntry(EventID(3, 3, 2), 5);
125  shouldBe.addEntry(EventID(3, 3, 3), 3);
126  shouldBe.addEntry(EventID::invalidEvent(RunID(6)), 9);
127  shouldBe.addEntry(EventID::invalidEvent(SubRunID(6, 0)), 9);
128  shouldBe.addEntry(EventID(6, 0, 4), 12);
129  shouldBe.addEntry(EventID::invalidEvent(SubRunID(6, 1)), 10);
130  shouldBe.addEntry(EventID(6, 1, 5), 13);
131  shouldBe.addEntry(EventID(6, 1, 6), 14);
132  shouldBe.addEntry(EventID(6, 1, 7), 15);
133  shouldBe.addEntry(EventID::invalidEvent(SubRunID(6, 3)), 11);
134  shouldBe.addEntry(EventID(6, 3, 9), 16);
135  shouldBe.addEntry(EventID::invalidEvent(SubRunID(6, 4)), 12);
136  shouldBe.addEntry(EventID::invalidEvent(SubRunID(6, 5)), 13);
137  shouldBe.addEntry(EventID(6, 5, 13), 17);
138  shouldBe.addEntry(EventID(6, 5, 14), 18);
139  shouldBe.addEntry(EventID::invalidEvent(SubRunID(6, 8)), 14);
140  shouldBe.addEntry(EventID(6, 8, 15), 19);
141  shouldBe.addEntry(EventID::invalidEvent(SubRunID(6, 9)), 15);
142  shouldBe.addEntry(EventID(6, 9, 5), 20);
143  shouldBe.addEntry(EventID(6, 9, 25), 21);
144  shouldBe.addEntry(EventID(6, 9, 25), 27);
145  shouldBe.addEntry(EventID::invalidEvent(RunID(9)), 10);
146  shouldBe.addEntry(EventID::invalidEvent(SubRunID(9, 1)), 16);
147  shouldBe.addEntry(EventID(9, 1, 5), 22);
148  shouldBe.addEntry(EventID::invalidEvent(SubRunID(9, 2)), 17);
149  shouldBe.addEntry(EventID(9, 2, 5), 23);
150 
151  BOOST_TEST(fileIndex == shouldBe);
152 
153  BOOST_TEST(fileIndex.allEventsInEntryOrder() == false);
154  BOOST_TEST(fileIndex.allEventsInEntryOrder() == false);
155 
156  auto it = fileIndex.findPosition(EventID(3, 3, 2));
157  BOOST_TEST((it - fileIndex.begin()) == 12);
158  BOOST_TEST(it->eventID == EventID(3, 3, 2));
159  BOOST_TEST(it->entry == 5);
160 
161  it = fileIndex.findPosition(EventID(3, 3, 7));
162  BOOST_TEST((it - fileIndex.begin()) == 14);
163 
164  it = fileIndex.findPosition(EventID(1, 2, 3));
165  BOOST_TEST((it - fileIndex.begin()) == 4);
166 
167  it = fileIndex.findPosition(EventID::invalidEvent(SubRunID(3, 3)));
168  BOOST_TEST((it - fileIndex.begin()) == 8);
169 
170  it = fileIndex.findPosition(EventID::invalidEvent(SubRunID(1, 1)));
171  BOOST_TEST((it - fileIndex.begin()) == 1);
172 
173  it = fileIndex.findPosition(EventID::invalidEvent(RunID(1)));
174  BOOST_TEST((it - fileIndex.begin()) == 0);
175 
176  it = fileIndex.findPosition(EventID::invalidEvent(RunID(2)));
177  BOOST_TEST((it - fileIndex.begin()) == 5);
178 
179  it = fileIndex.findPosition(EventID(2, 0, 1));
180  BOOST_TEST((it - fileIndex.begin()) == 5);
181 
182  it = fileIndex.findPosition(EventID(1, 2, 3));
183  BOOST_TEST((it - fileIndex.begin()) == 4);
184 
185  it = fileIndex.findPosition(EventID(3, 0, 3));
186  BOOST_TEST((it - fileIndex.begin()) == 7);
187 
188  it = fileIndex.findPosition(EventID(3, 3, 2), true);
189  BOOST_TEST((it - fileIndex.begin()) == 12);
190  BOOST_TEST(fileIndex.contains(EventID(3, 3, 2), true));
191 
192  it = fileIndex.findPosition(EventID(1, 2, 3), true);
193  BOOST_TEST(it == fileIndex.end());
194  BOOST_TEST(!fileIndex.contains(EventID(1, 2, 3), true));
195 
196  it = fileIndex.findPosition(EventID(1, 2, 3), false);
197  BOOST_TEST((it - fileIndex.begin()) == 4);
198  BOOST_TEST(fileIndex.contains(EventID(1, 2, 3), false));
199 
200  it = fileIndex.findPosition(EventID(3, 0, 1), true);
201  BOOST_TEST(it == fileIndex.end());
202 
203  it = fileIndex.findPosition(SubRunID(3, 1), true);
204  BOOST_TEST((it - fileIndex.begin()) == 7);
205 
206  it = fileIndex.findPosition(SubRunID(3, 2), true);
207  BOOST_TEST(it == fileIndex.end());
208 
209  it = fileIndex.findPosition(SubRunID(3, 1), false);
210  BOOST_TEST((it - fileIndex.begin()) == 7);
211 
212  it = fileIndex.findPosition(SubRunID(3, 2), false);
213  BOOST_TEST((it - fileIndex.begin()) == 8);
214 
215  BOOST_TEST(fileIndex.contains(SubRunID(3, 3), true));
216  BOOST_TEST(!fileIndex.contains(SubRunID(2, 3), true));
217 
218  it = fileIndex.findPosition(RunID(3), true);
219  BOOST_TEST((it - fileIndex.begin()) == 5);
220 
221  it = fileIndex.findPosition(RunID(2), true);
222  BOOST_TEST(it == fileIndex.end());
223 
224  it = fileIndex.findPosition(RunID(2), false);
225  BOOST_TEST((it - fileIndex.begin()) == 5);
226 
227  BOOST_TEST(fileIndex.contains(RunID(3), true));
228  BOOST_TEST(!fileIndex.contains(RunID(2), true));
229 
230  it = fileIndex.findSubRunOrRunPosition(SubRunID(1, 2));
231  BOOST_TEST((it - fileIndex.begin()) == 1);
232 
233  it = fileIndex.findSubRunOrRunPosition(SubRunID::invalidSubRun(RunID(3)));
234  BOOST_TEST((it - fileIndex.begin()) == 5);
235 
236  it = fileIndex.findSubRunOrRunPosition(SubRunID(3, 4));
237  BOOST_TEST((it - fileIndex.begin()) == 14);
238 
239  it = fileIndex.findSubRunOrRunPosition(SubRunID(3, 2));
240  BOOST_TEST((it - fileIndex.begin()) == 8);
241 
242  it = fileIndex.findSubRunOrRunPosition(SubRunID(2, 1));
243  BOOST_TEST((it - fileIndex.begin()) == 5);
244 
245  // Search for event without using subrun number.
246  it =
247  fileIndex.findPosition(EventID(SubRunID::invalidSubRun(RunID(1)), 4), true);
248  BOOST_TEST((it - fileIndex.begin()) == 4);
249 
250  it =
251  fileIndex.findPosition(EventID(SubRunID::invalidSubRun(RunID(1)), 5), true);
252  BOOST_TEST(it == fileIndex.end());
253 
254  it = fileIndex.findPosition(EventID(SubRunID::invalidSubRun(RunID(1)), 5),
255  false);
256  BOOST_TEST((it - fileIndex.begin()) == 10);
257 
258  it = fileIndex.findPosition(EventID(SubRunID::invalidSubRun(RunID(6)), 4),
259  false);
260  BOOST_TEST((it - fileIndex.begin()) == 16);
261 
262  it = fileIndex.findPosition(EventID(SubRunID::invalidSubRun(RunID(6)), 8),
263  false);
264  BOOST_TEST((it - fileIndex.begin()) == 22);
265 
266  it = fileIndex.findPosition(EventID(SubRunID::invalidSubRun(RunID(6)), 25),
267  false);
268  BOOST_TEST((it - fileIndex.begin()) == 31);
269 }
iterator begin()
Definition: FileIndex.cc:50
const_iterator findSubRunOrRunPosition(SubRunID const &srID) const
Definition: FileIndex.cc:306
bool allEventsInEntryOrder() const
Definition: FileIndex.cc:165
void sortBy_Run_SubRun_Event()
Definition: FileIndex.cc:149
const_iterator findPosition(EventID const &eID) const
Definition: FileIndex.cc:227
void addEntry(EventID const &eID, EntryNumber_t entry)
Definition: FileIndex.cc:134
iterator end()
Definition: FileIndex.cc:68
bool contains(EventID const &id, bool exact) const
Definition: FileIndex.cc:116
BOOST_AUTO_TEST_CASE ( eventEntrySortAndSearchTest  )

Definition at line 271 of file FileIndex_t.cc.

272 {
273 
274  // Note this contains some illegal duplicates
275  // For the moment there is nothing to prevent
276  // these from occurring so we handle this using
277  // a stable_sort for now ... They will not bother
278  // the FileIndex.
279 
280  art::FileIndex fileIndex;
281  fileIndex.addEntry(EventID(3, 3, 2), 5);
282  fileIndex.addEntry(EventID(3, 3, 1), 4);
283  fileIndex.addEntry(EventID(3, 3, 3), 3);
284  fileIndex.addEntry(EventID::invalidEvent(SubRunID(3, 3)), 6);
285  fileIndex.addEntry(EventID::invalidEvent(RunID(3)), 7);
286  fileIndex.addEntry(EventID::invalidEvent(RunID(1)), 8);
287  fileIndex.addEntry(EventID::invalidEvent(SubRunID(3, 1)), 9);
288  fileIndex.addEntry(EventID::invalidEvent(RunID(3)), 1);
289  fileIndex.addEntry(EventID::invalidEvent(SubRunID(3, 3)), 1);
290  fileIndex.addEntry(EventID(3, 3, 1), 1);
291  fileIndex.addEntry(EventID(1, 2, 2), 2);
292  fileIndex.addEntry(EventID(1, 2, 4), 1);
293  fileIndex.addEntry(EventID::invalidEvent(SubRunID(1, 2)), 2);
294  fileIndex.addEntry(EventID(1, 2, 1), 2);
295 
296  fileIndex.sortBy_Run_SubRun_EventEntry();
297 
298  art::FileIndex shouldBe;
299  shouldBe.addEntry(EventID::invalidEvent(RunID(1)), 8);
300  shouldBe.addEntry(EventID::invalidEvent(SubRunID(1, 2)), 2);
301  shouldBe.addEntry(EventID(1, 2, 4), 1);
302  shouldBe.addEntry(EventID(1, 2, 2), 2);
303  shouldBe.addEntry(EventID(1, 2, 1), 2);
304  shouldBe.addEntry(EventID::invalidEvent(RunID(3)), 7);
305  shouldBe.addEntry(EventID::invalidEvent(RunID(3)), 1);
306  shouldBe.addEntry(EventID::invalidEvent(SubRunID(3, 1)), 9);
307  shouldBe.addEntry(EventID::invalidEvent(SubRunID(3, 3)), 6);
308  shouldBe.addEntry(EventID::invalidEvent(SubRunID(3, 3)), 1);
309  shouldBe.addEntry(EventID(3, 3, 1), 1);
310  shouldBe.addEntry(EventID(3, 3, 3), 3);
311  shouldBe.addEntry(EventID(3, 3, 1), 4);
312  shouldBe.addEntry(EventID(3, 3, 2), 5);
313 
314  BOOST_TEST(fileIndex == shouldBe);
315 
316  auto it = fileIndex.findPosition(SubRunID(3, 1), true);
317  BOOST_TEST((it - fileIndex.begin()) == 7);
318 
319  it = fileIndex.findPosition(SubRunID(3, 2), true);
320  BOOST_TEST(it == fileIndex.end());
321 
322  it = fileIndex.findPosition(SubRunID(3, 1), false);
323  BOOST_TEST((it - fileIndex.begin()) == 7);
324 
325  it = fileIndex.findPosition(SubRunID(3, 2), false);
326  BOOST_TEST((it - fileIndex.begin()) == 8);
327 
328  it = fileIndex.findPosition(RunID(3), true);
329  BOOST_TEST((it - fileIndex.begin()) == 5);
330 
331  it = fileIndex.findPosition(RunID(2), true);
332  BOOST_TEST(it == fileIndex.end());
333 
334  it = fileIndex.findPosition(RunID(2), false);
335  BOOST_TEST((it - fileIndex.begin()) == 5);
336 
337  it = fileIndex.findSubRunOrRunPosition(SubRunID(1, 2));
338  BOOST_TEST((it - fileIndex.begin()) == 1);
339 
340  it = fileIndex.findSubRunOrRunPosition(SubRunID::invalidSubRun(RunID(3)));
341  BOOST_TEST((it - fileIndex.begin()) == 5);
342 
343  it = fileIndex.findSubRunOrRunPosition(SubRunID(3, 4));
344  BOOST_TEST(it == fileIndex.end());
345 
346  it = fileIndex.findSubRunOrRunPosition(SubRunID(3, 2));
347  BOOST_TEST((it - fileIndex.begin()) == 8);
348 
349  it = fileIndex.findSubRunOrRunPosition(SubRunID(2, 1));
350  BOOST_TEST((it - fileIndex.begin()) == 5);
351 }
iterator begin()
Definition: FileIndex.cc:50
const_iterator findSubRunOrRunPosition(SubRunID const &srID) const
Definition: FileIndex.cc:306
void sortBy_Run_SubRun_EventEntry()
Definition: FileIndex.cc:157
const_iterator findPosition(EventID const &eID) const
Definition: FileIndex.cc:227
void addEntry(EventID const &eID, EntryNumber_t entry)
Definition: FileIndex.cc:134
iterator end()
Definition: FileIndex.cc:68
BOOST_AUTO_TEST_CASE ( eventsUniqueAndOrderedTest  )

Definition at line 353 of file FileIndex_t.cc.

354 {
355  // Test the different cases
356 
357  // Nothing in the FileIndex
358  art::FileIndex fileIndex;
359  BOOST_TEST(fileIndex.eventsUniqueAndOrdered());
360 
361  // No events
362  art::FileIndex fileIndex1;
363  fileIndex1.addEntry(EventID::invalidEvent(RunID(1)), 1);
364  fileIndex1.addEntry(EventID::invalidEvent(SubRunID(1, 1)), 1);
365  BOOST_TEST(fileIndex1.eventsUniqueAndOrdered());
366 
367  // One event and nothing after it
368  art::FileIndex fileIndex2;
369  fileIndex2.addEntry(EventID::invalidEvent(RunID(1)), 1);
370  fileIndex2.addEntry(EventID::invalidEvent(SubRunID(1, 2)), 1);
371  fileIndex2.addEntry(EventID(1, 2, 1), 1);
372  BOOST_TEST(fileIndex2.eventsUniqueAndOrdered());
373 
374  // One event with a run after it
375  art::FileIndex fileIndex3;
376  fileIndex3.addEntry(EventID::invalidEvent(RunID(1)), 1);
377  fileIndex3.addEntry(EventID::invalidEvent(SubRunID(1, 2)), 1);
378  fileIndex3.addEntry(EventID(1, 2, 1), 1);
379  fileIndex3.addEntry(EventID::invalidEvent(RunID(2)), 2);
380  BOOST_TEST(fileIndex3.eventsUniqueAndOrdered());
381 
382  // Two events
383  art::FileIndex fileIndex4;
384  fileIndex4.addEntry(EventID::invalidEvent(RunID(1)), 1);
385  fileIndex4.addEntry(EventID::invalidEvent(SubRunID(1, 1)), 1);
386  fileIndex4.addEntry(EventID(1, 1, 1), 1);
387  fileIndex4.addEntry(EventID::invalidEvent(RunID(2)), 2);
388  fileIndex4.addEntry(EventID::invalidEvent(SubRunID(2, 1)), 2);
389  fileIndex4.addEntry(EventID(2, 1, 1), 2);
390  BOOST_TEST(fileIndex4.eventsUniqueAndOrdered());
391 
392  // Two events, same run and event number
393  art::FileIndex fileIndex5;
394  fileIndex5.addEntry(EventID::invalidEvent(RunID(1)), 1);
395  fileIndex5.addEntry(EventID::invalidEvent(SubRunID(1, 1)), 1);
396  fileIndex5.addEntry(EventID(1, 1, 1), 1);
397  fileIndex5.addEntry(EventID::invalidEvent(RunID(1)), 2);
398  fileIndex5.addEntry(EventID::invalidEvent(SubRunID(1, 2)), 2);
399  fileIndex5.addEntry(EventID(1, 2, 1), 2);
400  BOOST_TEST(fileIndex5.eventsUniqueAndOrdered());
401 
402  // Not ordered by run
403  art::FileIndex fileIndex6;
404  fileIndex6.addEntry(EventID::invalidEvent(RunID(1)), 1);
405  fileIndex6.addEntry(EventID::invalidEvent(SubRunID(1, 2)), 1);
406  fileIndex6.addEntry(EventID(1, 2, 1), 1);
407  fileIndex6.addEntry(EventID::invalidEvent(RunID(2)), 2);
408  fileIndex6.addEntry(EventID::invalidEvent(SubRunID(2, 1)), 2);
409  fileIndex6.addEntry(EventID(2, 1, 1), 2);
410  fileIndex6.addEntry(EventID::invalidEvent(RunID(1)), 3);
411  fileIndex6.addEntry(EventID::invalidEvent(SubRunID(1, 3)), 3);
412  fileIndex6.addEntry(EventID(1, 3, 1), 3);
413  BOOST_TEST(!fileIndex6.eventsUniqueAndOrdered());
414 
415  // Not ordered by event
416  art::FileIndex fileIndex7;
417  fileIndex7.addEntry(EventID::invalidEvent(RunID(1)), 1);
418  fileIndex7.addEntry(EventID::invalidEvent(SubRunID(1, 2)), 1);
419  fileIndex7.addEntry(EventID(1, 2, 1), 1);
420  fileIndex7.addEntry(EventID::invalidEvent(RunID(2)), 2);
421  fileIndex7.addEntry(EventID::invalidEvent(SubRunID(2, 1)), 2);
422  fileIndex7.addEntry(EventID(2, 1, 2), 2);
423  fileIndex7.addEntry(EventID::invalidEvent(SubRunID(2, 3)), 3);
424  fileIndex7.addEntry(EventID(2, 3, 1), 3);
425  BOOST_TEST(fileIndex7.eventsUniqueAndOrdered());
426 
427  // OK, ordered by event and unique
428  art::FileIndex fileIndex8;
429  fileIndex8.addEntry(EventID::invalidEvent(RunID(1)), 1);
430  fileIndex8.addEntry(EventID::invalidEvent(SubRunID(1, 1)), 1);
431  fileIndex8.addEntry(EventID(1, 1, 1), 1);
432  fileIndex8.addEntry(EventID(1, 1, 2), 1);
433  fileIndex8.addEntry(EventID(1, 1, 3), 1);
434  fileIndex8.addEntry(EventID(1, 1, 4), 1);
435  fileIndex8.addEntry(EventID::invalidEvent(RunID(2)), 2);
436  fileIndex8.addEntry(EventID::invalidEvent(SubRunID(2, 1)), 2);
437  fileIndex8.addEntry(EventID(2, 1, 1), 2);
438  fileIndex8.addEntry(EventID::invalidEvent(SubRunID(2, 3)), 3);
439  fileIndex8.addEntry(EventID(2, 3, 2), 3);
440  fileIndex8.addEntry(EventID(2, 3, 3), 3);
441  fileIndex8.addEntry(EventID(2, 3, 4), 3);
442  fileIndex8.addEntry(EventID(2, 3, 5), 3);
443  fileIndex8.addEntry(EventID(2, 3, 6), 3);
444  BOOST_TEST(fileIndex8.eventsUniqueAndOrdered());
445 }
void addEntry(EventID const &eID, EntryNumber_t entry)
Definition: FileIndex.cc:134
bool eventsUniqueAndOrdered() const
Definition: FileIndex.cc:186