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

TestCaseEventRepository_1.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseEventRepository_1.cpp 00005 // 00006 // Version 1.1 00007 // Date 18.04.03 00008 // Author A. Pasetti (P&P Software) 00009 00010 #include "TestCaseEventRepository_1.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 00018 TestCaseEventRepository_1::TestCaseEventRepository_1(void) : 00019 TestCaseGenericSetUp(ID_EVENTREPOSITORY*10+1,"TestCaseEventRepository_1") { 00020 return; 00021 } 00022 00023 void TestCaseEventRepository_1::runTestCase(void) { 00024 00025 DC_EventRepository* pRep = new DC_EventRepository(); 00026 00027 // Check the correctness of the class identifier 00028 if ( (pRep->getClassId() != ID_EVENTREPOSITORY) ) 00029 { setTestResult(TEST_FAILURE, 00030 "Wrong class identifier for the event repository class"); 00031 return; 00032 } 00033 00034 // Event repository objects are not configured upon creation 00035 if ( (pRep->isObjectConfigured() == CONFIGURED) ) 00036 { setTestResult(TEST_FAILURE, 00037 "Wrong event repository configuration status upon repository creation"); 00038 return; 00039 } 00040 00041 // Check the default values of the event repository attributes 00042 if ( !(pRep->isEnabled()) || 00043 (pRep->getCounter() != 0) || 00044 (pRep->getRepositorySize() != 0) ) 00045 { setTestResult(TEST_FAILURE, 00046 "Wrong default value of event repository attribute"); 00047 return; 00048 } 00049 00050 // Check default selective enable status (NB: event types are positive) 00051 for (unsigned int i=1; i<=(unsigned int)LAST_EVENT_TYPE; i++) 00052 if ( !pRep->isEnabled((TD_EventType)i) ) 00053 { setTestResult(TEST_FAILURE, 00054 "Wrong default value of selective enable status"); 00055 return; 00056 } 00057 00058 // Load an OBS Clock component 00059 DC_DummyObsClock* pClk = new DC_DummyObsClock(); 00060 pRep->setObsClock(pClk); 00061 00062 // Verify that the OBS Clock was properly loaded 00063 if (pRep->getObsClock()!=pClk) { 00064 setTestResult(TEST_FAILURE,"setObsClock() failed."); 00065 return; 00066 } 00067 00068 // Initialize the repository size 00069 pRep->setRepositorySize(4); 00070 00071 // Event repository should now be configured 00072 if ( (pRep->isObjectConfigured() == NOT_CONFIGURED) ) 00073 { setTestResult(TEST_FAILURE, 00074 "Wrong event repository configuration status after configuration"); 00075 return; 00076 } 00077 00078 // Check repository size 00079 if ( pRep->getRepositorySize() != 4) 00080 { setTestResult(TEST_FAILURE, 00081 "Wrong value of event repository size"); 00082 return; 00083 } 00084 00085 setTestResult(TEST_SUCCESS,"Test Successful"); 00086 return; 00087 }
Copyright 2003 P&P Software GmbH - All Rights Reserved