RunHeaderUnitTest.cpp
Go to the documentation of this file.
1 /*
2  * File: RunHeaderUnitTest.cpp
3  * Author: denis
4  *
5  * Created on September 24, 2012, 10:18 AM
6  */
7 //#include "DAQDataFormats/../unittest/RawDAQDataUnitTest.h"
8 //#include "DAQDataFormats/../unittest/RunHeaderConstructor.h"
9 #include "RawDAQDataUnitTest.h"
10 #include "RunHeaderConstructor.h"
11 
12 namespace daqdataformats {
13 
17  CPPUNIT_TEST(testReadDataIntoSameVersion);
18  CPPUNIT_TEST(testReadDataIntoUnknownVersion);
22 public:
25 
30 
31 private:
33 
34 private:
35  rawrunhdr::RunHeaderConstructor* _mainDFConstructor;
36 };
37 
38 //------------------------------------------------------------------------------
40  RawDAQDataUnitTest(new rawrunhdr::RunHeaderConstructor())
41  ,_mainDFConstructor((rawrunhdr::RunHeaderConstructor*)_dataFormatConstructor)
42 {
43 }
44 
45 //------------------------------------------------------------------------------
47 
48 //------------------------------------------------------------------------------
50 
51  RawRunHeader* df = (RawRunHeader*)_mainDFConstructor->getEmptyDataFormat(version);
52 
53  ASSERT_CHECK_FIELD(UniversalEventStart);
54  ASSERT_CHECK_FIELD(UniversalEventEnd);
55  ASSERT_CHECK_FIELD(CRC);
56  ASSERT_CHECK_FIELD(TriggerPrescaleListIDX);
57  ASSERT_CHECK_FIELD(TriggerListIDX);
58  ASSERT_CHECK_FIELD(ValidTriggerTypesHigh2);
59  ASSERT_CHECK_FIELD(ValidTriggerTypesHigh);
60  ASSERT_CHECK_FIELD(ValidTriggerTypesLow);
61  ASSERT_CHECK_FIELD(VTMod);
62  ASSERT_CHECK_FIELD(TriggerMC);
63  ASSERT_CHECK_FIELD(TriggerCtrlID);
65  ASSERT_CHECK_FIELD(RunSize);
66  ASSERT_CHECK_FIELD(UniversalEventEndHi);
67  ASSERT_CHECK_FIELD(UniversalEventEndLo);
68  ASSERT_CHECK_FIELD(UniversalEventStartHi);
69  ASSERT_CHECK_FIELD(UniversalEventStartLo);
70  ASSERT_CHECK_FIELD(TotalEvents);
71  ASSERT_CHECK_FIELD(RunEndTime);
72  ASSERT_CHECK_FIELD(SubRunEndTime);
73  ASSERT_CHECK_FIELD(SubRunStartTime);
74  ASSERT_CHECK_FIELD(RunStartTime);
75  ASSERT_CHECK_FIELD(DataLoggerID);
76  ASSERT_CHECK_FIELD(DataLoggerVersion);
77  ASSERT_CHECK_FIELD(RunControlID);
78  ASSERT_CHECK_FIELD(RunControlVersion);
79  ASSERT_CHECK_FIELD(ConfigurationBlockSet);
80  ASSERT_CHECK_FIELD(Subrun);
81  ASSERT_CHECK_FIELD(Partition);
82  ASSERT_CHECK_FIELD(ConfigIDX);
84  ASSERT_CHECK_FIELD(RunNumber);
85 
86  CPPUNIT_ASSERT(version == (version_t) df->getVersion());
87 
89 
90  delete df;
91 }
92 
93 //CPPUNIT_TEST_SUITE_REGISTRATION(RunHeaderUnitTest);
95 CPPUNIT_REGISTRY_ADD_TO_DEFAULT("DAQDataFormats");
96 
97 }; // end of class
#define DEFINE_testReadDataIntoSameVersion
#define DEFINE_testReadDataIntoUnknownVersion
#define ASSERT_PRINT_IS_NOT_UNKNOWN
virtual void basicFieldGetAndSetChecks()
Check all field gets and sets for all versions.
#define DEFINE_checkShallowCopyConstructor(CLASS)
Standard function that checks Shallow Copy Constructor.
virtual void checkShallowCopyConstructor()
Check Shallow Copy Constructors for all versions.
Base class for RawDAQData unittest.
CPPUNIT_TEST_SUITE(RunHeaderUnitTest)
CPPUNIT_TEST(basicFieldGetAndSetChecks)
virtual void basicFieldGetAndSetChecksForGivenVersion(const version_t)
Check all field gets and sets for a given version.
RawDAQDataConstructor * _dataFormatConstructor
Pointer to RawDAQDataConstructor.
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(ConfigurationBlockUnitTest,"DAQDataFormats")
#define DEFINE_checkDeepCopyConstructor(CLASS)
Standard function that checks Deep Copy Constructor.
const XML_Char * version
Definition: expat.h:187
virtual void checkDeepCopyConstructor()
Check Deep Copy Constructors for all versions.
#define ASSERT_CHECK_FIELD(FIELD_NAME)
Assert checking get/set of the the field is good.
int32_t version_t
Definition: RawDAQData.h:72
Class to hold the data from the FEBs in correct formats.
rawrunhdr::RunHeaderConstructor * _mainDFConstructor
CPPUNIT_REGISTRY_ADD_TO_DEFAULT("DAQDataFormats")