1x90geotests.cpp

Go to the documentation of this file.
00001 // Template for a test suite.
00002 #include <config.h>
00003 #include <cppunit/extensions/HelperMacros.h>
00004 #include <cppunit/Asserter.h>
00005 #include "Asserts.h"
00006 #include "CCAENV1x90.h"
00007 #include "DesignByContract.h"
00008 
00009 
00010 #ifdef HAVE_STD_NAMESPACE
00011 using namespace std;
00012 #endif
00013 
00014 
00015 extern long ModuleBase;
00016 
00017 class GeoTests : public CppUnit::TestFixture {
00018   CPPUNIT_TEST_SUITE(GeoTests);
00019   CPPUNIT_TEST(SlotMatch);
00020   CPPUNIT_TEST(SlotSet);
00021   CPPUNIT_TEST_SUITE_END();
00022 
00023 
00024 private:
00025   CCAENV1x90* m_pModule;
00026 
00027 public:
00028   // Construct a module in powered up condition:
00029 
00030   void setUp() {
00031     m_pModule = new CCAENV1x90(1, 0, ModuleBase);
00032     m_pModule->Reset();
00033   }
00034   // Delete the module to prevent resource leaks.
00035 
00036   void tearDown() {
00037     delete m_pModule;
00038   }
00039 protected:
00040   void SlotMatch();
00041   void SlotSet();
00042 };
00043 
00044 CPPUNIT_TEST_SUITE_REGISTRATION(GeoTests);
00045 
00046 
00047 // After enabling 
00048 // The trigger time tag enable bit should be set in the control register.
00049 
00050 void GeoTests::SlotMatch() {
00051   EQMSG("Initial slot ", 1, (int)m_pModule->GetGeographicalID());
00052 }
00053 
00054 
00055 // Should be able to turn off trigger time tag.
00056 
00057 void
00058 GeoTests::SlotSet()
00059 {
00060   // The legal ones:
00061 
00062   for(unsigned short nSlot = 0; nSlot < 32; nSlot++) {
00063     m_pModule->SetGeographicalID(nSlot);
00064     EQ(nSlot, m_pModule->GetGeographicalID());
00065   }
00066 
00067   // Try 256, the exact limit:
00068 
00069   EXCEPTION((m_pModule->SetGeographicalID(32)),
00070             DesignByContract::Require);
00071 
00072 
00073 }

Generated on Wed Sep 17 08:38:09 2008 for NSCL Device support. by  doxygen 1.5.1