Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

TestCaseEventRepository_3.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseEventRepository_3.cpp 00005 // 00006 // Version 1.1 00007 // Date 25.02.03 00008 // Author A. Pasetti (P&P Software) 00009 00010 #include "TestCaseEventRepository_3.h" 00011 #include "../GeneralInclude/CompilerSwitches.h" 00012 #include "../GeneralInclude/ClassId.h" 00013 #include "../GeneralInclude/Constants.h" 00014 #include "../Base/CC_RootObject.h" 00015 #include "../System/DC_DummyObsClock.h" 00016 #include "../Event/DC_EventRepository.h" 00017 #include "../Event/DC_Event.h" 00018 00019 TestCaseEventRepository_3::TestCaseEventRepository_3(void) : 00020 TestCaseGenericSetUp(ID_EVENTREPOSITORY*10+3,"TestCaseEventRepository_3") { 00021 return; 00022 } 00023 00024 void TestCaseEventRepository_3::runTestCase(void) { 00025 00026 DC_EventRepository* pRep = new DC_EventRepository(); 00027 00028 TD_EventType type1 = (TD_EventType)0x0001; 00029 TD_EventType type2 = (TD_EventType)0x0002; 00030 TD_EventType type3 = (TD_EventType)0x0010; 00031 00032 // Configure the event repository: load OBS clock and set repository size 00033 unsigned int size = 4; 00034 DC_DummyObsClock* pClk = new DC_DummyObsClock(); 00035 pRep->setObsClock(pClk); 00036 pRep->setRepositorySize(size); 00037 00038 // Check correct configuration 00039 if ( (pRep->isObjectConfigured() == NOT_CONFIGURED) ) 00040 { setTestResult(TEST_FAILURE, 00041 "Wrong event repository configuration status after configuration"); 00042 return; 00043 } 00044 00045 // Fill up the repository with a few events 00046 pRep->create(pRep,type1); 00047 pRep->create(pRep,type2); 00048 pRep->create(pRep,type3); 00049 pRep->create(pRep,type1); 00050 pRep->create(pRep,type2); 00051 00052 // Disable repository and check correctness 00053 pRep->setEnabled(DISABLED); 00054 if ( (pRep->isEnabled()) ) 00055 { setTestResult(TEST_FAILURE,"Wrong enable status"); 00056 return; 00057 } 00058 00059 // Retrieve status of the repository 00060 unsigned int counter = pRep->getCounter(); 00061 pRep->latest(); 00062 TD_EventType type = pRep->getEventType(); 00063 00064 // Attempt to create event and check that nothing happens 00065 pRep->create(pRep,type1); 00066 if ( (pRep->getCounter() != counter) ) 00067 { setTestResult(TEST_FAILURE,"Event created in disabled repository"); 00068 return; 00069 } 00070 pRep->latest(); 00071 if ( pRep->getEventType() != type ) 00072 { setTestResult(TEST_FAILURE, 00073 "Event created in disabled repository"); 00074 return; 00075 } 00076 00077 // Enable repositoy and check that events can now be created 00078 pRep->setEnabled(ENABLED); 00079 pRep->create(pRep,type3); 00080 if ( (pRep->getCounter() != counter+1) ) 00081 { setTestResult(TEST_FAILURE,"Failure to create event in enabled repository"); 00082 return; 00083 } 00084 pRep->latest(); 00085 if ( pRep->getEventType() != type3 ) 00086 { setTestResult(TEST_FAILURE, 00087 "Failure to create event in enabled repository"); 00088 return; 00089 } 00090 00091 // Set event repository mask and check that the correct mask is loaded 00092 pRep->setEnabled(type2,DISABLED); 00093 if ( pRep->isEnabled(type2) ) 00094 { setTestResult(TEST_FAILURE, 00095 "Error in setting event repository mask"); 00096 return; 00097 } 00098 00099 // Check that creation of masked event is disabled 00100 pRep->create(pRep,type2); 00101 if ( (pRep->getCounter() != counter+1) ) 00102 { setTestResult(TEST_FAILURE,"Failure to selectively disabled event creation"); 00103 return; 00104 } 00105 00106 // Check that creation of unmasked events is still ensabled 00107 pRep->create(pRep,type3); 00108 if ( (pRep->getCounter() != counter+2) ) 00109 { setTestResult(TEST_FAILURE,"Failure to selectively enabled event creation"); 00110 return; 00111 } 00112 00113 setTestResult(TEST_SUCCESS,"Test Successful"); 00114 return; 00115 }
Copyright 2003 P&P Software GmbH - All Rights Reserved