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

TestCaseManoeuvrePunctualAction_1.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseManoeuvrePunctualAction_1.cpp 00005 // 00006 // Version 1.0 00007 // Date 06.06.03 00008 // Author R. Totaro 00009 00010 #include "TestCaseManoeuvrePunctualAction_1.h" 00011 #include "../GeneralInclude/ClassId.h" 00012 #include "../GeneralInclude/Constants.h" 00013 #include "../GeneralInclude/CompilerSwitches.h" 00014 #include "../Manoeuvre/DC_DummyManoeuvre.h" 00015 #include "../Manoeuvre/CC_ManoeuvreManager.h" 00016 #include "../Manoeuvre/DC_ManoeuvrePunctualAction.h" 00017 00018 TestCaseManoeuvrePunctualAction_1::TestCaseManoeuvrePunctualAction_1(void) : 00019 TestCaseGenericSetUp(ID_MANOEUVREPUNCTUALACTION*10+1,"TestCaseManoeuvrePunctualAction_1") { 00020 return; 00021 } 00022 00023 void TestCaseManoeuvrePunctualAction_1::runTestCase(void) { 00024 Manoeuvre *pDM =new DC_DummyManoeuvre(); 00025 CC_ManoeuvreManager *pMM =new CC_ManoeuvreManager(); 00026 DC_ManoeuvrePunctualAction *pMPA=new DC_ManoeuvrePunctualAction(); 00027 00028 // Initialize the manoeuvre manager 00029 pMM->setPendingManoeuvreListSize(1); 00030 00031 // Verify correctness of class identifier 00032 if (pMPA->getClassId()!=ID_MANOEUVREPUNCTUALACTION) { 00033 setTestResult(TEST_FAILURE,"Wrong class identifier"); 00034 return; 00035 } 00036 00037 // The newly created object should not be configured 00038 if (pMPA->isObjectConfigured()) { 00039 setTestResult(TEST_FAILURE,"Newly created object is configured"); 00040 return; 00041 } 00042 00043 // We link a manoeuvre manager to the action and verify that 00044 // it is properly reported and the object is not yet configured 00045 pMPA->setManoeuvreManager(pMM); 00046 00047 if (pMPA->getManoeuvreManager()!=pMM) { 00048 setTestResult(TEST_FAILURE,"Could not set/get the manoeuvre manager"); 00049 return; 00050 } 00051 00052 if (pMPA->isObjectConfigured()) { 00053 setTestResult(TEST_FAILURE,"Wrong configuration status"); 00054 return; 00055 } 00056 00057 // We link a manoeuvre to the action and verify that it 00058 // is properly reported and the object is now configured 00059 pMPA->setManoeuvre(pDM); 00060 00061 if (pMPA->getManoeuvre()!=pDM) { 00062 setTestResult(TEST_FAILURE,"Could not set/get the manoeuvre"); 00063 return; 00064 } 00065 00066 if (!pMPA->isObjectConfigured()) { 00067 setTestResult(TEST_FAILURE,"Object is not configured"); 00068 return; 00069 } 00070 00071 // Let's execute the action and verify that the manoeuvre is loaded 00072 pMPA->execute(); 00073 00074 if (pMM->getPendingManoeuvres()!=1) { 00075 setTestResult(TEST_FAILURE,"Action failed to execute"); 00076 return; 00077 } 00078 00079 setTestResult(TEST_SUCCESS,"Test Successful"); 00080 return; 00081 }
Copyright 2003 P&P Software GmbH - All Rights Reserved