ConfigurationBlockUnitTest.cpp
Go to the documentation of this file.
1 /*
2  * File: ConfigurationBlockUnitTest.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/ConfigurationBlockConstructor.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  configurationblock::ConfigurationBlockConstructor* _mainDFConstructor;
36 };
37 
38 //------------------------------------------------------------------------------
40  RawDAQDataUnitTest(new configurationblock::ConfigurationBlockConstructor())
41  ,_mainDFConstructor((configurationblock::ConfigurationBlockConstructor*)_dataFormatConstructor)
42 {
43 }
44 
45 //------------------------------------------------------------------------------
47 
48 //------------------------------------------------------------------------------
50 
51  RawConfigurationBlock* df = (RawConfigurationBlock*)_mainDFConstructor->getEmptyDataFormat(version);
52 
53  CPPUNIT_ASSERT(version == (version_t) df->getConfigurationVersion());
54 
56 
57 
58  df = (RawConfigurationBlock*)_mainDFConstructor->getFilledDataFormat(version);
59 
60 
61  RawConfigurationSystemID* sysid = (RawConfigurationSystemID*)_mainDFConstructor->_configurationSystemIDConstructor.getFilledDataFormat(0);
62  CPPUNIT_ASSERT(compareDataFormats(df, sysid) == FIRST_CONTAINS_SECOND);
63  sysid->setVersionName("That's funny");
64  CPPUNIT_ASSERT(compareDataFormats(df, sysid) == FIRST_CONTAINS_SECOND);
65  sysid->setVersionName("Ho Ho Ho");
66  CPPUNIT_ASSERT(compareDataFormats(df, sysid) == FIRST_CONTAINS_SECOND);
67 
68 
69 
70 
71 
72 
73 
74  delete df;
75 }
76 
77 //CPPUNIT_TEST_SUITE_REGISTRATION(ConfigurationBlockUnitTest);
79 CPPUNIT_REGISTRY_ADD_TO_DEFAULT("DAQDataFormats");
80 
81 }; // end of class
#define DEFINE_testReadDataIntoSameVersion
#define DEFINE_testReadDataIntoUnknownVersion
virtual DATAFORMAT_COMPARE_RESULTS compareDataFormats(const RawDAQData *, const RawDAQData *) const
Are the two data formats the same?
#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.
const XML_Char const XML_Char * sysid
Definition: expat.h:300
CPPUNIT_TEST_SUITE(ConfigurationBlockUnitTest)
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.
int32_t version_t
Definition: RawDAQData.h:72
Class to hold the data from the FEBs in correct formats.
configurationblock::ConfigurationBlockConstructor * _mainDFConstructor
CPPUNIT_TEST(basicFieldGetAndSetChecks)
CPPUNIT_REGISTRY_ADD_TO_DEFAULT("DAQDataFormats")