Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /**
0002    \file
0003    test file for FEDRawData library
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 
0012 #include <iostream>
0013 
0014 class testFEDRawData : public CppUnit::TestFixture {
0015   CPPUNIT_TEST_SUITE(testFEDRawData);
0016 
0017   CPPUNIT_TEST(testCtor);
0018   CPPUNIT_TEST(testdata);
0019 
0020   CPPUNIT_TEST_SUITE_END();
0021 
0022 public:
0023   void setUp() {}
0024   void tearDown() {}
0025   void testCtor();
0026   void testdata();
0027 };
0028 
0029 ///registration of the test so that the runner can find it
0030 CPPUNIT_TEST_SUITE_REGISTRATION(testFEDRawData);
0031 
0032 void testFEDRawData::testCtor() {
0033   FEDRawData f;
0034   CPPUNIT_ASSERT(f.size() == 0);
0035 
0036   FEDRawData f2(24);
0037   CPPUNIT_ASSERT(f2.size() == size_t(24));
0038 }
0039 
0040 void testFEDRawData::testdata() {
0041   FEDRawData f(48);
0042   f.data()[0] = 'a';
0043   f.data()[1] = 'b';
0044   f.data()[47] = 'c';
0045 
0046   const unsigned char* buf = f.data();
0047 
0048   CPPUNIT_ASSERT(buf[0] == 'a');
0049   CPPUNIT_ASSERT(buf[1] == 'b');
0050   CPPUNIT_ASSERT(buf[47] == 'c');
0051 }
0052 
0053 #include <Utilities/Testing/interface/CppUnit_testdriver.icpp>