Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:59

0001 #include <cppunit/extensions/HelperMacros.h>
0002 
0003 #include "CondFormats/Common/interface/UpdateStamp.h"
0004 #include "CondFormats/Common/interface/TimeConversions.h"
0005 
0006 namespace {
0007 
0008    class TestUpdateStamp: public CppUnit::TestFixture
0009    {
0010      CPPUNIT_TEST_SUITE(TestUpdateStamp);
0011      CPPUNIT_TEST(construct);
0012      CPPUNIT_TEST(stamp);
0013      CPPUNIT_TEST_SUITE_END();
0014       public:
0015      void setUp(){}
0016      void tearDown(){}
0017      void construct();
0018      void stamp();
0019 
0020    };
0021 
0022   void TestUpdateStamp::construct() {
0023     cond::UpdateStamp object;
0024     CPPUNIT_ASSERT(-1==object.m_revision);
0025     CPPUNIT_ASSERT(0==object.m_timestamp);
0026     CPPUNIT_ASSERT("not stamped"==object.m_comment);
0027   }
0028 
0029   void TestUpdateStamp::stamp() {
0030     cond::UpdateStamp object;
0031     cond::Time_t otime = cond::time::now();
0032     {
0033       cond::Time_t btime = cond::time::now();
0034       object.stamp("V0");
0035       cond::Time_t atime = cond::time::now();
0036       CPPUNIT_ASSERT(0==object.m_revision);
0037       CPPUNIT_ASSERT(object.m_timestamp>=otime);
0038       CPPUNIT_ASSERT(object.m_timestamp>=btime);
0039       CPPUNIT_ASSERT(atime>=object.m_timestamp);
0040       CPPUNIT_ASSERT("V0"==object.m_comment);
0041     }
0042     {
0043       cond::Time_t btime = cond::time::now();
0044       object.stamp("V1");
0045       cond::Time_t atime = cond::time::now();
0046       CPPUNIT_ASSERT(1==object.m_revision);
0047       CPPUNIT_ASSERT(object.m_timestamp>=otime);
0048       CPPUNIT_ASSERT(object.m_timestamp>=btime);
0049       CPPUNIT_ASSERT(atime>=object.m_timestamp);
0050       CPPUNIT_ASSERT("V1"==object.m_comment);
0051     }
0052 
0053 
0054 
0055   }
0056 
0057 }
0058 
0059 CPPUNIT_TEST_SUITE_REGISTRATION(TestUpdateStamp);
0060 #include "Utilities/Testing/interface/CppUnit_testdriver.icpp"