Macros | Functions
EventID_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "canvas/Persistency/Provenance/EventID.h"

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE(EventID_t)
 

Functions

 BOOST_AUTO_TEST_CASE (DefaultConstruction)
 
 BOOST_AUTO_TEST_CASE (FullSpecConstruction)
 
 BOOST_AUTO_TEST_CASE (Flush)
 
 BOOST_AUTO_TEST_CASE (Comparison)
 
 BOOST_AUTO_TEST_CASE (Iteration)
 
 BOOST_AUTO_TEST_CASE (AllowConstructedZeroEvent)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE (   EventID_t)

Definition at line 1 of file EventID_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( DefaultConstruction  )

Definition at line 10 of file EventID_t.cc.

11 {
12  EventID def;
13  BOOST_TEST(!def.isValid());
14  BOOST_TEST(!def.subRunID().isValid());
15  BOOST_TEST(!def.runID().isValid());
16 }
bool isValid() const
Definition: EventID.h:122
RunID const & runID() const
Definition: EventID.h:92
SubRunID const & subRunID() const
Definition: EventID.h:104
bool isValid() const
Definition: SubRunID.h:97
bool isValid() const
Definition: RunID.h:70
BOOST_AUTO_TEST_CASE ( FullSpecConstruction  )

Definition at line 18 of file EventID_t.cc.

19 {
20  EventNumber_t const et = 1;
21  RunNumber_t const rt = 2;
22  SubRunNumber_t const srt = 5;
23  EventID good(rt, srt, et);
24  BOOST_TEST(good.run() == rt);
25  BOOST_TEST(good.subRun() == srt);
26  BOOST_TEST(good.event() == et);
27 }
IDNumber_t< Level::SubRun > SubRunNumber_t
Definition: IDNumber.h:119
IDNumber_t< Level::Event > EventNumber_t
Definition: IDNumber.h:118
IDNumber_t< Level::Run > RunNumber_t
Definition: IDNumber.h:120
BOOST_AUTO_TEST_CASE ( Flush  )

Definition at line 29 of file EventID_t.cc.

30 {
31  EventID f(EventID::flushEvent());
32  BOOST_TEST(f.isValid());
33  BOOST_TEST(f.isFlush());
34  BOOST_TEST(f.subRunID().isFlush());
35  BOOST_TEST(f.runID().isFlush());
36 
37  EventID fs(EventID::flushEvent(RunID::firstRun()));
38  BOOST_TEST(fs.isValid());
39  BOOST_TEST(fs.isFlush());
40  BOOST_TEST(fs.subRunID().isFlush());
41  BOOST_TEST(!fs.runID().isFlush());
42  BOOST_TEST(fs.run() == RunID::firstRun().run());
43 
44  BOOST_REQUIRE_THROW(EventID(f.run(), f.subRun(), f.event()), art::Exception);
45 }
static constexpr double fs
Definition: Units.h:100
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
BOOST_AUTO_TEST_CASE ( Comparison  )

Definition at line 47 of file EventID_t.cc.

48 {
49  EventID const small(1, 1, 1);
50  EventID const med(2, 2, 2);
51  EventID const med2(2, 2, 2);
52  EventID const large(3, 3, 2);
53  EventID const largest(3, 3, 3);
54  BOOST_TEST(small < med);
55  BOOST_TEST(small <= med);
56  BOOST_TEST(!(small == med));
57  BOOST_TEST(small != med);
58  BOOST_TEST(!(small > med));
59  BOOST_TEST(!(small >= med));
60  BOOST_TEST(med2 == med);
61  BOOST_TEST(med2 <= med);
62  BOOST_TEST(med2 >= med);
63  BOOST_TEST(!(med2 != med));
64  BOOST_TEST(!(med2 < med));
65  BOOST_TEST(!(med2 > med));
66  BOOST_TEST(med < large);
67  BOOST_TEST(med <= large);
68  BOOST_TEST(!(med == large));
69  BOOST_TEST(med != large);
70  BOOST_TEST(!(med > large));
71  BOOST_TEST(!(med >= large));
72  BOOST_TEST(large < largest);
73  BOOST_TEST(large <= largest);
74  BOOST_TEST(!(large == largest));
75  BOOST_TEST(large != largest);
76  BOOST_TEST(!(large > largest));
77  BOOST_TEST(!(large >= largest));
78 }
BOOST_AUTO_TEST_CASE ( Iteration  )

Definition at line 80 of file EventID_t.cc.

81 {
82  EventID first = EventID::firstEvent();
83  EventID second = first.next();
84  BOOST_TEST(first < second);
85  BOOST_TEST(first == (second.previous()));
86  EventID run2(2, 1, 1);
87  BOOST_TEST(run2 < run2.nextRun());
88  BOOST_TEST(run2 < run2.nextSubRun());
89 
90  EventID largeEvent(SubRunID::firstSubRun(), EventID::maxEvent().event());
91  BOOST_TEST(largeEvent.isValid());
92  EventID next(largeEvent.next());
93  BOOST_TEST(SubRunID::firstSubRun().next() == next.subRunID());
94  BOOST_TEST(next.event() == EventID::firstEvent().event());
95  BOOST_TEST(next.isValid());
96  BOOST_TEST(!next.isFlush());
97 }
EventID previous() const
Definition: EventID.h:159
EventID next() const
Definition: EventID.h:134
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:85
BOOST_AUTO_TEST_CASE ( AllowConstructedZeroEvent  )

Definition at line 99 of file EventID_t.cc.

100 {
101  EventID e1(3u, 0u, 0u);
102  BOOST_TEST(e1.event() == 0u);
103  EventID e2(SubRunID(3u, 0u), 0u);
104  BOOST_TEST(e2.event() == 0u);
105  BOOST_TEST(e2.nextSubRun(0u).event() == 0u);
106 }