NanoSliceHeaderUnitTest.cpp
Go to the documentation of this file.
1 /*
2  * File: NanoSliceHeaderUnitTest.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/NanoSliceHeaderConstructor.h"
9 #include "RawDAQDataUnitTest.h"
11 
12 namespace daqdataformats {
13 
17  CPPUNIT_TEST(testReadDataIntoSameVersion);
18  CPPUNIT_TEST(testReadDataIntoUnknownVersion);
22 public:
25 
30 
31 private:
33 
34 private:
35  nanosliceheader::NanoSliceHeaderConstructor* _mainDFConstructor;
36 };
37 
38 //------------------------------------------------------------------------------
40  RawDAQDataUnitTest(new nanosliceheader::NanoSliceHeaderConstructor())
41  ,_mainDFConstructor((nanosliceheader::NanoSliceHeaderConstructor*)_dataFormatConstructor)
42 {
43 }
44 
45 //------------------------------------------------------------------------------
47 
48 //------------------------------------------------------------------------------
50 
51  RawNanoSliceHeader* df = (RawNanoSliceHeader*)_mainDFConstructor->getEmptyDataFormat(version);
52  ASSERT_CHECK_FIELD(LinkStatus);
53  ASSERT_CHECK_FIELD(DataPresent);
54  ASSERT_CHECK_FIELD(DebugMode);
55  ASSERT_CHECK_FIELD(FEBId);
56  ASSERT_CHECK_FIELD(FEBStatus);
57  ASSERT_CHECK_FIELD(PixelAddr);
58  ASSERT_CHECK_FIELD(Sequence);
59  ASSERT_CHECK_FIELD(Pad3);
60  ASSERT_CHECK_FIELD(DAQEnabled);
61  ASSERT_CHECK_FIELD(BufferEmpty);
62  ASSERT_CHECK_FIELD(BufferFull);
63  ASSERT_CHECK_FIELD(CommError);
64  ASSERT_CHECK_FIELD(PacketError);
65  ASSERT_CHECK_FIELD(OverflowError);
66  ASSERT_CHECK_FIELD(ADCError);
67  CPPUNIT_ASSERT(version == (version_t) df->getVersion());
68 
70 
71  delete df;
72 }
73 
74 //CPPUNIT_TEST_SUITE_REGISTRATION(NanoSliceHeaderUnitTest);
76 CPPUNIT_REGISTRY_ADD_TO_DEFAULT("DAQDataFormats");
77 
78 }; // end of class
#define DEFINE_testReadDataIntoSameVersion
#define DEFINE_testReadDataIntoUnknownVersion
CPPUNIT_TEST_SUITE(NanoSliceHeaderUnitTest)
#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.
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.
nanosliceheader::NanoSliceHeaderConstructor * _mainDFConstructor
const XML_Char * version
Definition: expat.h:187
CPPUNIT_TEST(basicFieldGetAndSetChecks)
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.
CPPUNIT_REGISTRY_ADD_TO_DEFAULT("DAQDataFormats")