Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:07

0001 /*
0002  *  eventid_t.cppunit.cc
0003  *  CMSSW
0004  *
0005  *  Created by Chris Jones on 8/8/05.
0006  *
0007  */
0008 
0009 #include "cppunit/extensions/HelperMacros.h"
0010 
0011 #include "DataFormats/Provenance/interface/Timestamp.h"
0012 
0013 using namespace edm;
0014 
0015 class testTimestamp : public CppUnit::TestFixture {
0016   CPPUNIT_TEST_SUITE(testTimestamp);
0017 
0018   CPPUNIT_TEST(constructTest);
0019   CPPUNIT_TEST(comparisonTest);
0020 
0021   CPPUNIT_TEST_SUITE_END();
0022 
0023 public:
0024   void setUp() {}
0025   void tearDown() {}
0026 
0027   void constructTest();
0028   void comparisonTest();
0029 };
0030 
0031 ///registration of the test so that the runner can find it
0032 CPPUNIT_TEST_SUITE_REGISTRATION(testTimestamp);
0033 
0034 void testTimestamp::constructTest() {
0035   const TimeValue_t t = 2;
0036 
0037   Timestamp temp(t);
0038 
0039   CPPUNIT_ASSERT(temp.value() == t);
0040 
0041   CPPUNIT_ASSERT(Timestamp::invalidTimestamp() < Timestamp::beginOfTime());
0042   CPPUNIT_ASSERT(Timestamp::beginOfTime() < Timestamp::endOfTime());
0043 }
0044 
0045 void testTimestamp::comparisonTest() {
0046   const Timestamp small(1);
0047   const Timestamp med(2);
0048 
0049   CPPUNIT_ASSERT(small < med);
0050   CPPUNIT_ASSERT(small <= med);
0051   CPPUNIT_ASSERT(!(small == med));
0052   CPPUNIT_ASSERT(small != med);
0053   CPPUNIT_ASSERT(!(small > med));
0054   CPPUNIT_ASSERT(!(small >= med));
0055 }