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

TestCaseTestPUSConfigurableManoeuvre_1.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseTestPUSConfigurableManoeuvre_1.cpp 00005 // 00006 // Version 1.0 00007 // Date 06.02.04 00008 // Author A. Pasetti 00009 00010 #include "TestCaseTestPUSConfigurableManoeuvre_1.h" 00011 #include "../GeneralInclude/ClassId.h" 00012 #include "../GeneralInclude/Constants.h" 00013 #include "../GeneralInclude/CompilerSwitches.h" 00014 #include "../Utilities/TestCaseWithEvtCheck.h" 00015 #include "../Manoeuvre/DC_TestPUSConfigurableManoeuvre.h" 00016 00017 TestCaseTestPUSConfigurableManoeuvre_1::TestCaseTestPUSConfigurableManoeuvre_1(void) : 00018 TestCaseWithEvtCheck(ID_TESTPUSCONFIGURABLEMANOEUVRE*10+1, 00019 "TestCaseTestPUSConfigurableManoeuvre_1") { 00020 return; 00021 } 00022 00023 void TestCaseTestPUSConfigurableManoeuvre_1::runTestCase(void) { 00024 DC_TestPUSConfigurableManoeuvre *pDCM=new DC_TestPUSConfigurableManoeuvre(); 00025 00026 // Verify correctness of class identifier 00027 if (pDCM->getClassId()!=ID_TESTPUSCONFIGURABLEMANOEUVRE) { 00028 setTestResult(TEST_FAILURE,"Wrong class identifier"); 00029 return; 00030 } 00031 00032 // Check that the action counters are set to zero 00033 if (pDCM->getInitializationActionCounter()!=0 || 00034 pDCM->getContinuationActionCounter() !=0 || 00035 pDCM->getTerminationActionCounter() !=0) { 00036 setTestResult(TEST_FAILURE,"Action counter(s) not equal to zero"); 00037 return; 00038 } 00039 00040 // Check completion and progress acknowledge flag values 00041 if (pDCM->isCompletionAckRequired() || pDCM->isProgressAckRequired() || pDCM->isStartAckRequired() ) { 00042 setTestResult(TEST_FAILURE,"Incorrect acknowledge flag default values"); 00043 return; 00044 } 00045 00046 // Set and read back start, completion and progress acknowledge flag values 00047 pDCM->setStartAckFlag(true); 00048 pDCM->setCompletionAckFlag(true); 00049 pDCM->setProgressAckFlag(true); 00050 if (!pDCM->isCompletionAckRequired() || !pDCM->isProgressAckRequired()) { 00051 setTestResult(TEST_FAILURE,"Incorrect acknowledge flag default values"); 00052 return; 00053 } 00054 00055 // Set and read back telecommand identifier value 00056 pDCM->setTelecommandId(13); 00057 if (pDCM->getTelecommandId()!=13) { 00058 setTestResult(TEST_FAILURE,"Incorrect telecommand ID value"); 00059 return; 00060 } 00061 00062 // Verify the canStart() return value 00063 pDCM->setInUse(true); 00064 if (pDCM->canStart()!=MAN_CANNOT_START) { 00065 setTestResult(TEST_FAILURE,"Incorrect canStart() return value"); 00066 return; 00067 } 00068 00069 // Verify that the initializationActionCounter is incremented 00070 pDCM->initialize(); 00071 if (pDCM->getInitializationActionCounter()!=1) { 00072 setTestResult(TEST_FAILURE,"initializationActionCounter not incremented"); 00073 return; 00074 } 00075 00076 // Verify that the continuationActionCounter is incremented 00077 pDCM->doContinue(); 00078 if (pDCM->getContinuationActionCounter()!=1) { 00079 setTestResult(TEST_FAILURE,"continuationActionCounter not incremented"); 00080 return; 00081 } 00082 00083 // Verify a "manoeuvre progress event" is generated when the manoeuvre advances 00084 unsigned int nEvt = this->getNumberOfEvents(); 00085 pDCM->doContinue(); 00086 if (pDCM->getContinuationActionCounter()!=2) { 00087 setTestResult(TEST_FAILURE,"continuationActionCounter not incremented"); 00088 return; 00089 } 00090 if (!verifyLatestEvent(nEvt+1,EVT_MAN_PROGRESS)) 00091 return; 00092 00093 // Check that the continuation flag is properly set 00094 if (pDCM->canContinue()!=MAN_CANNOT_CONTINUE) { 00095 setTestResult(TEST_FAILURE,"Incorrect canContinue() return value"); 00096 return; 00097 } 00098 00099 // Check that the termination flag is properly set 00100 if (pDCM->isFinished()!=MAN_HAS_NOT_TERMINATED) { 00101 setTestResult(TEST_FAILURE,"Incorrect isFinished() return value"); 00102 return; 00103 } 00104 00105 // Verify that the terminationActionCounter is incremented 00106 pDCM->terminate(); 00107 if (pDCM->getTerminationActionCounter()!=1) { 00108 setTestResult(TEST_FAILURE,"terminationActionCounter not incremented"); 00109 return; 00110 } 00111 00112 // Check that the status flags can be modified 00113 pDCM->setStartCheckStatus(MAN_CAN_START); 00114 pDCM->setContinuationCheckStatus(MAN_CAN_CONTINUE); 00115 pDCM->setTerminationCheckStatus(MAN_HAS_TERMINATED); 00116 00117 pDCM->initialize(); 00118 00119 if (pDCM->canStart()!=MAN_CAN_START) { 00120 setTestResult(TEST_FAILURE,"Incorrect canStart() return value"); 00121 return; 00122 } 00123 00124 pDCM->doContinue(); 00125 00126 if (pDCM->canContinue()!=MAN_CAN_CONTINUE) { 00127 setTestResult(TEST_FAILURE,"Incorrect canContinue() return value"); 00128 return; 00129 } 00130 00131 if (pDCM->isFinished()!=MAN_HAS_TERMINATED) { 00132 setTestResult(TEST_FAILURE,"Incorrect isFinished() return value"); 00133 return; 00134 } 00135 00136 pDCM->terminate(); 00137 00138 setTestResult(TEST_SUCCESS,"Test Successful"); 00139 return; 00140 }
Copyright 2003 P&P Software GmbH - All Rights Reserved