00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
#include "../Data/ControlBlock.h"
00013
#include "TestCaseControlAction_1.h"
00014
#include "../GeneralInclude/CompilerSwitches.h"
00015
#include "../GeneralInclude/ClassId.h"
00016
#include "../GeneralInclude/Constants.h"
00017
#include "../Data/DC_ControlAction.h"
00018
#include "../Data/DC_DummyCopyControlBlock.h"
00019
00020
00021 TestCaseControlAction_1::TestCaseControlAction_1(
void) :
00022
TestCaseGenericSetUp(ID_CONTROLACTION*10+1,
00023 "
TestCaseControlAction_1") {
00024 }
00025
00026 void TestCaseControlAction_1::runTestCase(
void) {
00027
DC_ControlAction *pAct=
new DC_ControlAction;
00028
00029
00030
if (pAct->
getClassId()!=ID_CONTROLACTION) {
00031 setTestResult(
TEST_FAILURE,
"Wrong class identifier");
00032
return;
00033 }
00034
00035
00036
if (pAct->
isObjectConfigured()) {
00037 setTestResult(
TEST_FAILURE,
"Wrong configuration status");
00038
return;
00039 }
00040
00041
00042
DC_DummyCopyControlBlock *pDCB =
new DC_DummyCopyControlBlock;
00043
const unsigned int numInputs =3;
00044
const TD_Float inputValues[]={(
TD_Float)0.3,(
TD_Float)0.04,(
TD_Float)0.05};
00045
00046
00047
for (
int i=0;i<numInputs;i++)
00048 pDCB->
setInput(i,inputValues[i]);
00049
00050
00051 pAct->
setTargetControlBlock(pDCB);
00052
if (pAct->
getTargetControlBlock()!=pDCB) {
00053 setTestResult(
TEST_FAILURE,
"Loaded control block is wrong");
00054
return;
00055 }
00056
00057
00058
if (!pAct->
isObjectConfigured()) {
00059 setTestResult(
TEST_FAILURE,
"Wrong configuration status");
00060
return;
00061 }
00062
00063
00064
00065
TD_Float initialState=pDCB->
getState(0);
00066
00067 pAct->
execute();
00068
if (pDCB->
getState(0)==initialState) {
00069 setTestResult(
TEST_FAILURE,
"Execution request failure");
00070
return;
00071 }
00072
00073
00074
00075
00076 pAct->
reset();
00077
if (pDCB->
getState(0)!=initialState) {
00078 setTestResult(
TEST_FAILURE,
"Reset request failure");
00079
return;
00080 }
00081
00082 setTestResult(
TEST_SUCCESS,
"Test Successful");
00083
return;
00084 }