TimeStamp_t.cc
Go to the documentation of this file.
1 #define BOOST_TEST_MODULE (TimeStamp_t)
2 #include "boost/test/unit_test.hpp"
4 
5 using art::Timestamp;
6 using art::TimeValue_t;
7 
8 BOOST_AUTO_TEST_SUITE(TimeStamp_t)
9 
10 BOOST_AUTO_TEST_CASE(constructTest)
11 {
12  constexpr TimeValue_t t = 2;
13  constexpr Timestamp temp(t);
14 
15  static_assert(temp.value() == t);
16 
17  static_assert(Timestamp::invalidTimestamp() < Timestamp::beginOfTime());
18  static_assert(Timestamp::beginOfTime() < Timestamp::endOfTime());
19  static_assert(Timestamp::endOfTime().value() + 1 == 0);
20 
21  constexpr Timestamp db(0xdeadbeefbeefdead);
22 
23  static_assert(db.timeLow() == 0xbeefdead);
24  static_assert(db.timeHigh() == 0xdeadbeef);
25  static_assert(db.value() == 0xdeadbeefbeefdead);
26 }
27 
28 BOOST_AUTO_TEST_CASE(comparisonTest)
29 {
30  constexpr Timestamp small(1);
31  constexpr Timestamp med(2);
32 
33  static_assert(small < med);
34  static_assert(small <= med);
35  static_assert(!(small == med));
36  static_assert(small != med);
37  static_assert(!(small > med));
38  static_assert(!(small >= med));
39 }
40 
41 BOOST_AUTO_TEST_SUITE_END()
double TimeStamp_t
us since 1970, based on TimeService
Definition: OpDetWaveform.h:23
BOOST_AUTO_TEST_CASE(constructTest)
Definition: TimeStamp_t.cc:10
std::uint64_t TimeValue_t
Definition: Timestamp.h:8