timestamp_t.cppunit.cc
Go to the documentation of this file.
1 /*
2  * eventid_t.cppunit.cc
3  * CMSSW
4  *
5  * Created by Chris Jones on 8/8/05.
6  * Copyright 2005 __MyCompanyName__. All rights reserved.
7  *
8  */
9 
10 #include <cppunit/extensions/HelperMacros.h>
11 
13 
14 using namespace art;
15 
16 class testTimestamp : public CppUnit::TestFixture {
17  CPPUNIT_TEST_SUITE(testTimestamp);
18 
19  CPPUNIT_TEST(constructTest);
20  CPPUNIT_TEST(comparisonTest);
21 
22  CPPUNIT_TEST_SUITE_END();
23 
24 public:
25  void
27  {}
28  void
30  {}
31 
32  void constructTest();
33  void comparisonTest();
34 };
35 
36 /// registration of the test so that the runner can find it
38 
39 void
41 {
42  const TimeValue_t t = 2;
43 
44  Timestamp temp(t);
45 
46  CPPUNIT_ASSERT(temp.value() == t);
47 
49  CPPUNIT_ASSERT(Timestamp::beginOfTime() < Timestamp::endOfTime());
50  CPPUNIT_ASSERT(Timestamp::endOfTime().value() + 1 == 0);
51 
52  Timestamp db(0xdeadbeefbeefdead);
53 
54  CPPUNIT_ASSERT(db.timeLow() == 0xbeefdead);
55  CPPUNIT_ASSERT(db.timeHigh() == 0xdeadbeef);
56  CPPUNIT_ASSERT(db.value() == 0xdeadbeefbeefdead);
57 }
58 
59 void
61 {
62  const Timestamp small(1);
63  const Timestamp med(2);
64 
65  CPPUNIT_ASSERT(small < med);
66  CPPUNIT_ASSERT(small <= med);
67  CPPUNIT_ASSERT(!(small == med));
68  CPPUNIT_ASSERT(small != med);
69  CPPUNIT_ASSERT(!(small > med));
70  CPPUNIT_ASSERT(!(small >= med));
71 }
constexpr std::uint32_t timeLow() const
Definition: Timestamp.h:29
static constexpr Timestamp endOfTime()
Definition: Timestamp.h:87
constexpr std::uint32_t timeHigh() const
Definition: Timestamp.h:34
CPPUNIT_TEST_SUITE_REGISTRATION(testTimestamp)
registration of the test so that the runner can find it
static constexpr Timestamp beginOfTime()
Definition: Timestamp.h:92
constexpr TimeValue_t value() const
Definition: Timestamp.h:23
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:82
std::uint64_t TimeValue_t
Definition: Timestamp.h:8
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225