00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
#include "TestCaseDummyManoeuvre_1.h"
00011
#include "../GeneralInclude/ClassId.h"
00012
#include "../GeneralInclude/Constants.h"
00013
#include "../GeneralInclude/CompilerSwitches.h"
00014
#include "../Manoeuvre/DC_DummyManoeuvre.h"
00015
00016 TestCaseDummyManoeuvre_1::TestCaseDummyManoeuvre_1(
void) :
00017
TestCaseWithEvtCheck(ID_DUMMYMANOEUVRE*10+1,"
TestCaseDummyManoeuvre_1")
00018 {
00019
return;
00020 }
00021
00022 void TestCaseDummyManoeuvre_1::runTestCase()
00023 {
00024
DC_DummyManoeuvre *pDM =
new DC_DummyManoeuvre();
00025
const unsigned int nEvt=
getNumberOfEvents();
00026
00027
00028
if (pDM->
getClassId()!=ID_DUMMYMANOEUVRE) {
00029 setTestResult(
TEST_FAILURE,
"Wrong class identifier");
00030
return;
00031 }
00032
00033
00034
if (!pDM->
isEnabled()) {
00035 setTestResult(
TEST_FAILURE,
"Manoeuvre not enabled");
00036
return;
00037 }
00038
00039
00040
if ( pDM->
getContinuationCheckCode()!=0 ) {
00041 setTestResult(
TEST_FAILURE,
"Continuation check code is incorrect");
00042
return;
00043 }
00044
00045
00046
if (pDM->
isInUse()) {
00047 setTestResult(
TEST_FAILURE,
"Wrong value of inUse flag (true)");
00048
return;
00049 }
00050
00051
00052
if (pDM->
isExecuting()) {
00053 setTestResult(
TEST_FAILURE,
"Wrong value of isExecuting flag (true)");
00054
return;
00055 }
00056
00057
00058
if (pDM->
isSuspended()) {
00059 setTestResult(
TEST_FAILURE,
"Wrong value of isSuspended flag (true)");
00060
return;
00061 }
00062
00063
00064 pDM->
setEnabled(
false);
00065
if (pDM->
isEnabled()) {
00066 setTestResult(
TEST_FAILURE,
"Failed to disable the manoeuvre");
00067
return;
00068 }
00069
00070
00071 pDM->
setInUse(
true);
00072
if (!pDM->
isInUse()) {
00073 setTestResult(
TEST_FAILURE,
"Failed to change the inUse flag");
00074
return;
00075 }
00076
00077
00078 pDM->
setIsSuspended(
true);
00079
if (!pDM->
isSuspended()) {
00080 setTestResult(
TEST_FAILURE,
"Failed to change the isSuspended flag");
00081
return;
00082 }
00083
00084
00085
if (!verifyLatestEvent(nEvt+1,EVT_MAN_SUSPENDED))
00086
return;
00087
00088
00089 pDM->
setIsSuspended(
false);
00090
if (!verifyLatestEvent(nEvt+2,EVT_MAN_RESUMED))
00091
return;
00092
00093
00094
if (pDM->
canStart()!=
MAN_CANNOT_START) {
00095 setTestResult(
TEST_FAILURE,
"Disabled manoeuvre can be started");
00096
return;
00097 }
00098
00099
00100 pDM->
setEnabled(
true);
00101
if (pDM->
canStart()!=
MAN_CAN_START) {
00102 setTestResult(
TEST_FAILURE,
"Enabled manoeuvre cannot be started");
00103
return;
00104 }
00105
00106
00107 pDM->
initialize();
00108 pDM->
doContinue();
00109
00110
00111
if (!pDM->
isExecuting()) {
00112 setTestResult(
TEST_FAILURE,
"Manoeuvre cannot be started");
00113
return;
00114 }
00115
00116
00117
if (!verifyLatestEvent(nEvt+3,EVT_MAN_STARTED))
00118
return;
00119
00120
00121
if (!pDM->
canContinue()) {
00122 setTestResult(
TEST_FAILURE,
"canContinue() reports wrong status");
00123
return;
00124 }
00125
00126
00127
if (!pDM->
isFinished()) {
00128 setTestResult(
TEST_FAILURE,
"Failed termination check");
00129
return;
00130 }
00131
00132
00133 pDM->
abort();
00134
if (pDM->
isExecuting()) {
00135 setTestResult(
TEST_FAILURE,
"Manoeuvre cannot be aborted");
00136
return;
00137 }
00138
00139
if (!verifyLatestEvent(nEvt+4,EVT_MAN_ABORTED))
00140
return;
00141
00142
00143 pDM->
initialize();
00144 pDM->
doContinue();
00145 pDM->
terminate();
00146
if (pDM->
isExecuting()) {
00147 setTestResult(
TEST_FAILURE,
"Failed to terminate the manoeuvre");
00148
return;
00149 }
00150
00151
00152
00153
if (!verifyLatestEvent(nEvt+6,EVT_MAN_TERMINATED))
00154
return;
00155
00156 setTestResult(
TEST_SUCCESS,
"Test Successful");
00157
return;
00158 }