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

TestCasePunctualActionManager_1.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCasePunctualActionManager_1.cpp 00005 // 00006 // Version 1.0 00007 // Date 30.09.03 00008 // Author R. Totaro 00009 00010 #include "../GeneralInclude/CompilerSwitches.h" 00011 #include "../GeneralInclude/ClassId.h" 00012 #include "../Base/DC_DummyPunctualAction.h" 00013 #include "../Base/DC_SimplePunctualActionModeManager.h" 00014 #include "../Base/CC_PunctualActionManager.h" 00015 #include "TestCasePunctualActionManager_1.h" 00016 00017 TestCasePunctualActionManager_1::TestCasePunctualActionManager_1(void) : 00018 TestCaseGenericSetUp(ID_PUNCTUALACTIONMANAGER*10+1,"TestCasePunctualActionManager_1") { 00019 return; 00020 } 00021 00022 void TestCasePunctualActionManager_1::runTestCase(void) { 00023 const unsigned int numberOfActions=4; 00024 CC_PunctualActionManager *pPAM =new CC_PunctualActionManager; 00025 DC_SimplePunctualActionModeManager *pPAMM=new DC_SimplePunctualActionModeManager; 00026 00027 // Configure the mode manager and the add a newly created 00028 // punctual actions to its only list 00029 pPAMM->setListLength(0,numberOfActions); 00030 00031 for (unsigned int i=0;i<numberOfActions;i++) 00032 pPAMM->setListItem(0,i,new DC_DummyPunctualAction); 00033 00034 pPAMM->reset(); 00035 00036 // Verify the correctness of the class id 00037 if (pPAM->getClassId()!=ID_PUNCTUALACTIONMANAGER) { 00038 setTestResult(TEST_FAILURE,"Wrong class id"); 00039 return; 00040 } 00041 00042 // A newly created action manager shall not be configured 00043 if (pPAM->isObjectConfigured()) { 00044 setTestResult(TEST_FAILURE,"Wrong configuration status at creation"); 00045 return; 00046 } 00047 00048 // The mode manager pointer shall be null 00049 if (pPAM->getPunctualActionModeManager()) { 00050 setTestResult(TEST_FAILURE,"Non NULL mode manager pointer at creation"); 00051 return; 00052 } 00053 00054 // Now we set the mode manager pointer and we verify that it is properly 00055 // stored and that the object is configured 00056 pPAM->setPunctualActionModeManager(pPAMM); 00057 if (pPAM->getPunctualActionModeManager()!=pPAMM) { 00058 setTestResult(TEST_FAILURE,"setPunctualActionModeManager() failed"); 00059 return; 00060 } 00061 00062 if (!pPAM->isObjectConfigured()) { 00063 setTestResult(TEST_FAILURE,"Wrong configuration status"); 00064 return; 00065 } 00066 00067 // The activate() method is invoked twice and it is verified that 00068 // the punctual actions' activation counters reflect this fact 00069 pPAM->activate(); 00070 pPAM->activate(); 00071 00072 for (pPAMM->first();pPAMM->isIterationFinished();pPAMM->next()) { 00073 DC_DummyPunctualAction *pDPA; 00074 00075 pDPA=(DC_DummyPunctualAction *)pPAMM->getIterationPunctualAction(); 00076 if (pDPA->getActivationCounter()!=2) { 00077 setTestResult(TEST_FAILURE,"activate() failed"); 00078 return; 00079 } 00080 } 00081 00082 setTestResult(TEST_SUCCESS,"Test Successful"); 00083 return; 00084 }
Copyright 2003 P&P Software GmbH - All Rights Reserved