#include #include #include // Unbelievably ugly hack to let me test private methods. #define private public #define protected public #include "ICOMETContext.hxx" #undef private #undef protected namespace tut { struct baseTCOMETContext { baseTCOMETContext() { // Run before each test. } ~baseTCOMETContext() { // Run after each test. } }; // Declare the test typedef test_group::object testTCOMETContext; test_group groupTCOMETContext("ICOMETContext"); // Test the default constructor and destructor. template<> template<> void testTCOMETContext::test<1> () { COMET::ICOMETContext g1; int invalid = 0xdeadbeef; ensure_equals("Invald value matches 0XDEADBEEF", COMET::ICOMETContext::Invalid, invalid); ensure_equals("Invald value matches 0XDEADBEEF", COMET::ICOMETContext::Invalid, (int) 0XDEADBEEF); } // Test the default constructor and destructor for the partition. template<> template<> void testTCOMETContext::test<2> () { COMET::ICOMETContext g1; int invalid = 0xdeadbeef; ensure_equals("Partition value is 0xDEADBEEF", g1.GetPartition(), invalid); ensure_equals("Partition value matches COMET::ICOMETContext::Invalid", g1.GetPartition(), COMET::ICOMETContext::Invalid); } // Test the default constructor and destructor for the run. template<> template<> void testTCOMETContext::test<3> () { COMET::ICOMETContext g1; int invalid = 0xdeadbeef; ensure_equals("Run value is 0xDEADBEEF", g1.GetRun(), invalid); ensure_equals("Run value matches COMET::ICOMETContext::Invalid", g1.GetRun(), COMET::ICOMETContext::Invalid); } // Test the default constructor and destructor for the sub run. template<> template<> void testTCOMETContext::test<4> () { COMET::ICOMETContext g1; int invalid = 0xdeadbeef; ensure_equals("Sub run value is 0xDEADBEEF", g1.GetSubRun(), invalid); ensure_equals("Sub run value matches COMET::ICOMETContext::Invalid", g1.GetSubRun(), COMET::ICOMETContext::Invalid); } // Test the default constructor and destructor for the event. template<> template<> void testTCOMETContext::test<5> () { COMET::ICOMETContext g1; int invalid = 0xdeadbeef; ensure_equals("Event number value is 0xDEADBEEF", g1.GetEvent(), invalid); ensure_equals("Event number value matches COMET::ICOMETContext::Invalid", g1.GetEvent(), COMET::ICOMETContext::Invalid); } // Test the default constructor and destructor for the spill. template<> template<> void testTCOMETContext::test<6> () { COMET::ICOMETContext g1; int invalid = 0xdeadbeef; ensure_equals("Spill number value is 0xDEADBEEF", g1.GetSpill(), invalid); ensure_equals("Spill number value matches COMET::ICOMETContext::Invalid", g1.GetSpill(), COMET::ICOMETContext::Invalid); } // Test the default constructor and destructor for the time stamp. template<> template<> void testTCOMETContext::test<7> () { COMET::ICOMETContext g1; int invalid = 0xdeadbeef; ensure_equals("Time stamp value is 0xDEADBEEF", g1.GetTimeStamp(), invalid); ensure_equals("Partition value matches COMET::ICOMETContext::Invalid", g1.GetTimeStamp(), COMET::ICOMETContext::Invalid); } //Test value constructor for the partition. template<> template<> void testTCOMETContext::test<8> () { COMET::ICOMETContext g1(1,1,1,1,1,1); int value = 1; ensure_equals("Partition value is 1", g1.GetPartition(), value); } //Test value constructor for the run. template<> template<> void testTCOMETContext::test<9> () { COMET::ICOMETContext g1(1,1,1,1,1,1); int value = 1; ensure_equals("Run value is 1", g1.GetRun(), value); } //Test value constructor for the sub run. template<> template<> void testTCOMETContext::test<10> () { COMET::ICOMETContext g1(1,1,1,1,1,1); int value = 1; ensure_equals("Sub run value is 1", g1.GetSubRun(), value); } //Test value constructor for the event. template<> template<> void testTCOMETContext::test<11> () { COMET::ICOMETContext g1(1,1,1,1,1,1); int value = 1; ensure_equals("Event number value is 1", g1.GetEvent(), value); } //Test value constructor for the spill. template<> template<> void testTCOMETContext::test<12> () { COMET::ICOMETContext g1(1,1,1,1,1,1); int value = 1; ensure_equals("Spill number value is 1", g1.GetSpill(), value); } //Test value constructor for the time stamp. template<> template<> void testTCOMETContext::test<13> () { COMET::ICOMETContext g1(1,1,1,1,1,1); int value = 1; ensure_equals("Time stamp value is 1", g1.GetTimeStamp(), value); ensure_equals("Time stamp value is '1970-01-01 00:00:01'", g1.GetTimeStampString(), "'1970-01-01 00:00:01'"); } };