Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:21

0001 /**
0002    \file
0003    unit test file for class FEDRawDataProduct 
0004 
0005    \author Stefano ARGIRO
0006    \date 28 Jun 2005
0007 */
0008 
0009 #include <cppunit/extensions/HelperMacros.h>
0010 #include <DataFormats/FEDRawData/interface/FEDRawData.h>
0011 #include <DataFormats/FEDRawData/interface/FEDRawDataCollection.h>
0012 
0013 class testFEDRawDataProduct : public CppUnit::TestFixture {
0014   CPPUNIT_TEST_SUITE(testFEDRawDataProduct);
0015 
0016   CPPUNIT_TEST(testInsertAndReadBack);
0017 
0018   CPPUNIT_TEST_SUITE_END();
0019 
0020 public:
0021   void setUp() {}
0022   void tearDown() {}
0023   void testInsertAndReadBack();
0024 };
0025 
0026 ///registration of the test so that the runner can find it
0027 CPPUNIT_TEST_SUITE_REGISTRATION(testFEDRawDataProduct);
0028 
0029 void testFEDRawDataProduct::testInsertAndReadBack() {
0030   FEDRawData f1(16);
0031   f1.data()[0] = 'a';
0032   f1.data()[1] = 'b';
0033 
0034   FEDRawData f2(24);
0035   f2.data()[0] = 'd';
0036   f2.data()[1] = 'e';
0037 
0038   FEDRawDataCollection fp;
0039   fp.FEDData(12) = f1;
0040   fp.FEDData(121) = f2;
0041 
0042   CPPUNIT_ASSERT(fp.FEDData(12).data()[0] == 'a');
0043   CPPUNIT_ASSERT(fp.FEDData(12).data()[1] == 'b');
0044 
0045   CPPUNIT_ASSERT(fp.FEDData(121).data()[0] == 'd');
0046   CPPUNIT_ASSERT(fp.FEDData(121).data()[1] == 'e');
0047 }