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

TestCaseManoeuvreManager_3.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseManoeuvreManager_3.cpp 00005 // 00006 // Version 1.0 00007 // Date 31.08.03 00008 // Author A. Pasetti 00009 00010 #include "TestCaseManoeuvreManager_3.h" 00011 #include "../GeneralInclude/ClassId.h" 00012 #include "../GeneralInclude/Constants.h" 00013 #include "../GeneralInclude/CompilerSwitches.h" 00014 #include "../Manoeuvre/DC_DummyConfigurableManoeuvre.h" 00015 #include "../Manoeuvre/CC_ManoeuvreManager.h" 00016 00017 TestCaseManoeuvreManager_3::TestCaseManoeuvreManager_3(void) : 00018 TestCaseWithEvtCheck(ID_MANOEUVREMANAGER*10+3,"TestCaseManoeuvreManager_3") { 00019 return; 00020 } 00021 00022 void TestCaseManoeuvreManager_3::runTestCase(void) { 00023 CC_ManoeuvreManager *pMM =new CC_ManoeuvreManager(); 00024 DC_DummyConfigurableManoeuvre *pDCM; 00025 00026 // Initialize the manoeuvre manager 00027 pMM->setPendingManoeuvreListSize(1); 00028 00029 // Allocate, load and set the start and continuation flag of the manoeuvre 00030 pDCM = new DC_DummyConfigurableManoeuvre(); 00031 pDCM->setInUse(true); 00032 pMM->load(pDCM); 00033 pDCM->setStartCheckStatus(MAN_CAN_START); 00034 pDCM->setContinuationCheckStatus(MAN_CAN_CONTINUE); 00035 pDCM->setTerminationCheckStatus(MAN_HAS_NOT_TERMINATED); 00036 00037 // Verify initial value of activation step counter 00038 if ( pDCM->getActivationStepCounter() != 0 ) { 00039 setTestResult(TEST_FAILURE,"Wrong initial value of activation step counter"); 00040 return; 00041 } 00042 00043 // Invoke twice the activate method and verify that the manoeuvre 00044 // continuation counter has been incremented twice 00045 pMM->activate(); 00046 pMM->activate(); 00047 if ( pDCM->getContinuationActionCounter() != 2 ) { 00048 setTestResult(TEST_FAILURE,"Wrong value of manoeuvre continuation counter"); 00049 return; 00050 } 00051 00052 // Verify value of activation step counter 00053 if ( pDCM->getActivationStepCounter() != 2 ) { 00054 setTestResult(TEST_FAILURE,"Wrong value of activation step counter"); 00055 return; 00056 } 00057 00058 // Suspend the manoeuvre, invoke the activate method, and verify that the manoeuvre 00059 // continuation counter has not been incremented 00060 pDCM->setIsSuspended(true); 00061 pMM->activate(); 00062 if ( pDCM->getContinuationActionCounter() != 2 ) { 00063 setTestResult(TEST_FAILURE,"Wrong value of manoeuvre continuation counter"); 00064 return; 00065 } 00066 00067 // Verify value of activation step counter 00068 if ( pDCM->getActivationStepCounter() != 2 ) { 00069 setTestResult(TEST_FAILURE,"Wrong value of activation step counter"); 00070 return; 00071 } 00072 00073 // Force the termination of the manoeuvre and verify that the manoeuvre status 00074 // changes to "not suspended" 00075 pDCM->setTerminationCheckStatus(MAN_HAS_TERMINATED); 00076 pDCM->setIsSuspended(true); 00077 pMM->activate(); 00078 if ( pDCM->getContinuationActionCounter() != 2 ) { 00079 setTestResult(TEST_FAILURE,"Wrong value of manoeuvre continuation counter"); 00080 return; 00081 } 00082 if ( pDCM->isSuspended() ) { 00083 setTestResult(TEST_FAILURE,"Wrong manoeuvre suspension status"); 00084 return; 00085 } 00086 00087 // Reload the manoeuvre, suspend it, activate it and verify that the 00088 // activation step counter has been reset to 0 00089 pDCM->setTerminationCheckStatus(MAN_HAS_NOT_TERMINATED); 00090 pMM->load(pDCM); 00091 pDCM->setIsSuspended(true); 00092 pMM->activate(); 00093 if ( pDCM->getActivationStepCounter() != 0 ) { 00094 setTestResult(TEST_FAILURE,"Wrong value of activation step counter"); 00095 return; 00096 } 00097 if ( pDCM->getInitializationActionCounter() != 2 ) { 00098 setTestResult(TEST_FAILURE,"Wrong value of manoeuvre continuation counter"); 00099 return; 00100 } 00101 00102 // Abort the manoeuvre and verify that its status is changed back to "not suspended" 00103 pDCM->abort(); 00104 if ( pDCM->isSuspended() ) { 00105 setTestResult(TEST_FAILURE,"Wrong manoeuvre suspension status"); 00106 return; 00107 } 00108 00109 // Verify value of activation step counter 00110 00111 setTestResult(TEST_SUCCESS,"Test Successful"); 00112 return; 00113 }
Copyright 2003 P&P Software GmbH - All Rights Reserved