00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
#include "../GeneralInclude/CompilerSwitches.h"
00015
#include "../GeneralInclude/ClassId.h"
00016
#include "../GeneralInclude/Constants.h"
00017
#include "../Base/DC_DummyPunctualAction.h"
00018
#include "TestCaseDummyPunctualAction_1.h"
00019
00020 TestCaseDummyPunctualAction_1::TestCaseDummyPunctualAction_1(
void) :
00021
TestCaseWithEvtCheck(ID_DUMMYPUNCTUALACTION*10+1,"
TestCaseDummyPunctualAction_1") {
00022
return;
00023 }
00024
00025 void TestCaseDummyPunctualAction_1::runTestCase(
void) {
00026
const unsigned int nEvt =
getNumberOfEvents();
00027
DC_DummyPunctualAction *pAct=
new DC_DummyPunctualAction;
00028
00029
00030
if (pAct->
getClassId()!=ID_DUMMYPUNCTUALACTION) {
00031 setTestResult(
TEST_FAILURE,
"Wrong class identifier");
00032
return;
00033 }
00034
00035
00036
if (!pAct->
isEnabled()) {
00037 setTestResult(
TEST_FAILURE,
"Wrong enable status at creation");
00038
return;
00039 }
00040
00041
00042
if (pAct->
getActivationCounter()) {
00043 setTestResult(
TEST_FAILURE,
"Wrong activation counter at creation");
00044
return;
00045 }
00046
00047
00048
if (pAct->
getLastOutcome()!=ACTION_RESET) {
00049 setTestResult(
TEST_FAILURE,
"Wrong action outcome at creation");
00050
return;
00051 }
00052
00053
00054
00055
if (pAct->
execute()!=ACTION_SUCCESS) {
00056 setTestResult(
TEST_FAILURE,
"Wrong punctual action outcome");
00057
return;
00058 }
00059
00060
if (!verifyLatestEvent(nEvt+1,EVT_PUNCTUAL_ACTION_EXEC))
00061
return;
00062
00063
00064
if (pAct->
getActivationCounter()!=1) {
00065 setTestResult(
TEST_FAILURE,
"Activation counter was not incremented");
00066
return;
00067 }
00068
00069
00070 pAct->
setEnabled(
DISABLED);
00071
if (pAct->
isEnabled()) {
00072 setTestResult(
TEST_FAILURE,
"Punctual action was not disabled");
00073
return;
00074 }
00075
00076
00077
00078
if (pAct->
execute()!=ACTION_DISABLED) {
00079 setTestResult(
TEST_FAILURE,
"Wrong punctual action outcome");
00080
return;
00081 }
00082
00083
if (!verifyLatestEvent(nEvt+2,EVT_PUNCTUAL_ACTION_DIS))
00084
return;
00085
00086
00087
if (pAct->
getLastOutcome()!=ACTION_DISABLED ) {
00088 setTestResult(
TEST_FAILURE,
"Wrong puctual action outcome");
00089
return;
00090 }
00091
00092
00093 pAct->
resetLastOutcome();
00094
if (pAct->
getLastOutcome()!=ACTION_RESET) {
00095 setTestResult(
TEST_FAILURE,
"getLastOutcome() failed");
00096
return;
00097 }
00098
00099 setTestResult(
TEST_SUCCESS,
"Test Successful");
00100
return;
00101 }