1x90RegisterTests.cpp

Go to the documentation of this file.
00001 // Template for a test suite.
00002 // Test register driven accesses:
00003 #include <config.h>
00004 #include <cppunit/extensions/HelperMacros.h>
00005 #include <cppunit/Asserter.h>
00006 #include "Asserts.h"
00007 #include "CCAENV1x90.h"
00008 #include "DesignByContract.h"
00009 
00010 #ifdef HAVE_STD_NAMESPACE
00011 using namespace std;
00012 #endif
00013 
00014 extern unsigned long ModuleBase;
00015 
00016 using namespace DesignByContract;
00017 
00018 // Test a bunch of stuff that is handled via register
00019 // addressing (non micro sequencer stuff).
00020 
00021 class Registertests : public CppUnit::TestFixture {
00022   CPPUNIT_TEST_SUITE(Registertests);
00023   CPPUNIT_TEST(AlmostFullLevel);
00024   CPPUNIT_TEST(ECLOutputSelect);
00025   CPPUNIT_TEST_SUITE_END();
00026 
00027 
00028 private:
00029   CCAENV1x90* m_pModule;
00030 
00031 public:
00032   void setUp() { 
00033     m_pModule = new CCAENV1x90(1, 0, ModuleBase);
00034     m_pModule->Reset();
00035   
00036   }
00037   void tearDown() {
00038     delete m_pModule;
00039   }
00040 protected:
00041   void AlmostFullLevel();
00042   void ECLOutputSelect();
00043 };
00044 
00045 CPPUNIT_TEST_SUITE_REGISTRATION(Registertests);
00046 
00047 
00048 // Check Set/GetAlmostFullLevel.
00049 
00050 void Registertests::AlmostFullLevel() {
00051 
00052 
00053   // Check the legal range:
00054 
00055   for(unsigned int i = 1; i <= 32735; i++) {
00056     m_pModule->SetAlmostFullLevel(i);
00057     EQ(i, (unsigned int)m_pModule->GetAlmostFullLevel());
00058   }
00059 
00060   // Check Illegal range.
00061 
00062   EXCEPTION((m_pModule->SetAlmostFullLevel(0)),
00063             Require);
00064   EXCEPTION((m_pModule->SetAlmostFullLevel(32736)),
00065             Require);
00066 
00067 }
00068 //  Check the Define/Get ECLOtutputDefinition functions:
00069 //
00070 void
00071 Registertests::ECLOutputSelect()
00072 {
00073   m_pModule->DefineECLOutput(CCAENV1x90::DATA_READY);
00074   EQMSG("Data Ready",   CCAENV1x90::DATA_READY, 
00075         m_pModule->GetECLOutputDefinition());
00076 
00077   m_pModule->DefineECLOutput(CCAENV1x90::FULL);
00078   EQMSG("Full ", CCAENV1x90::FULL,
00079         m_pModule->GetECLOutputDefinition());
00080 
00081   m_pModule->DefineECLOutput(CCAENV1x90::ALMOST_FULL);
00082   EQMSG("Almost FUll", CCAENV1x90::ALMOST_FULL,
00083         m_pModule->GetECLOutputDefinition());
00084 
00085   m_pModule->DefineECLOutput(CCAENV1x90::ERROR);
00086   EQMSG("Error ", CCAENV1x90::ERROR,
00087         m_pModule->GetECLOutputDefinition());
00088 
00089 }

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