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

TestCaseDummyFsmState_1.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseDummyFsmState_1.cpp 00005 // 00006 // Version 1.0 00007 // Date 13.09.02 00008 // Author A. Pasetti (P&P Software) 00009 00010 #include "../GeneralInclude/CompilerSwitches.h" 00011 #include "../GeneralInclude/ClassId.h" 00012 #include "../GeneralInclude/Constants.h" 00013 #include "../FSM/FsmState.h" 00014 #include "../FSM/DC_DummyFsmState.h" 00015 #include "TestCaseDummyFsmState_1.h" 00016 00017 TestCaseDummyFsmState_1::TestCaseDummyFsmState_1(void) : 00018 TestCaseGenericSetUp(ID_DUMMYFSMSTATE*10+1,"TestCaseDummyFsmState_1") { 00019 return; 00020 } 00021 00022 void TestCaseDummyFsmState_1::runTestCase(void) { 00023 00024 DC_DummyFsmState* pFsmState = new DC_DummyFsmState(); 00025 00026 // Verify correctness of class ID 00027 if (pFsmState->getClassId() != ID_DUMMYFSMSTATE) 00028 { setTestResult(TEST_FAILURE, "Wrong class ID"); 00029 return; 00030 } 00031 00032 // Check correct value of "next state" at creation 00033 if ( pFsmState->getNextState() != pNULL ) 00034 { setTestResult(TEST_FAILURE, "Incorrect initial value of next state"); 00035 return; 00036 } 00037 // Load a "next state" and check correctness 00038 DC_DummyFsmState* pNextState = new DC_DummyFsmState(); 00039 pFsmState->setNextState(pNextState); 00040 if ( pFsmState->getNextState() != pNextState ) 00041 { setTestResult(TEST_FAILURE, "Incorrect loading of next state"); 00042 return; 00043 } 00044 00045 // Check correctness of exit, termination and initialization checks 00046 if ( (pFsmState->canExit() != true) || 00047 (pFsmState->isFinished() != false) || 00048 (pFsmState->canEnter() != true) ) 00049 { setTestResult(TEST_FAILURE, "Incorrect check return values at creation"); 00050 return; 00051 } 00052 00053 // Perform actions 00054 pFsmState->doInit(); 00055 pFsmState->doContinue(); 00056 pFsmState->doExit(); 00057 00058 // Check correctness of exit, termination and initialization checks 00059 if ( (pFsmState->canExit() != true) || 00060 (pFsmState->isFinished() != false) || 00061 (pFsmState->canEnter() != true) ) 00062 { setTestResult(TEST_FAILURE, "Incorrect check return values after actions"); 00063 return; 00064 } 00065 00066 setTestResult(TEST_SUCCESS,"Test Successful"); 00067 return; 00068 }
Copyright 2003 P&P Software GmbH - All Rights Reserved