00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
#include "../GeneralInclude/CompilerSwitches.h"
00019
#include "../GeneralInclude/ClassId.h"
00020
#include "../GeneralInclude/Constants.h"
00021
#include "../FDIR/DC_InRangeProfile.h"
00022
#include "../FDIR/DC_ProfileList.h"
00023
#include "TestCaseProfileList_1.h"
00024
00025 TestCaseProfileList_1::TestCaseProfileList_1(
void) :
00026
TestCaseWithEvtCheck(ID_PROFILELIST*10+1,"
TestCaseProfileList_1") {
00027
return;
00028 }
00029
00030 void TestCaseProfileList_1::runTestCase(
void) {
00031
DC_ProfileList *pPL =
new DC_ProfileList;
00032
const unsigned int nEvt =
getNumberOfEvents();
00033
const unsigned int listSize =2;
00034
const TD_Float rangeWidth=5.0;
00035
DC_InRangeProfile *pIRP[listSize];
00036
00037
00038
00039
for (
unsigned int i=0;i<listSize;i++) {
00040 pIRP[i]=
new DC_InRangeProfile;
00041 pIRP[i]->
setLowerBound((
TD_Float)i);
00042 pIRP[i]->
setUpperBound((
TD_Float)i+rangeWidth);
00043 }
00044
00045
00046
if (pPL->
getClassId()!=ID_PROFILELIST) {
00047 setTestResult(
TEST_FAILURE,
"Wrong class identifier");
00048
return;
00049 }
00050
00051
00052
if (pPL->
isObjectConfigured()) {
00053 setTestResult(
TEST_FAILURE,
"Newly created object already configured");
00054
return;
00055 }
00056
00057
00058 pPL->
setListSize(listSize);
00059
if (pPL->
getListSize()!=listSize) {
00060 setTestResult(
TEST_FAILURE,
"getListSize() failed");
00061
return;
00062 }
00063
00064
00065
for (
unsigned int i=0;i<listSize;i++) {
00066
00067
if (pPL->
isObjectConfigured()) {
00068 setTestResult(
TEST_FAILURE,
"Wrong configuration status");
00069
return;
00070 }
00071
00072 pPL->
setMonitoringProfile(i,pIRP[i]);
00073
00074
if (pPL->
getMonitoringProfile(i)!=pIRP[i]) {
00075 setTestResult(
TEST_FAILURE,
"setMonitoringProfile() failed");
00076
return;
00077 }
00078 }
00079
00080
00081
if (!pPL->
isObjectConfigured()) {
00082 setTestResult(
TEST_FAILURE,
"Object not configured");
00083
return;
00084 }
00085
00086
00087
00088
if (
isNonNominalCheckAllowed()) {
00089 pPL->
setMonitoringProfile(listSize,pIRP[0]);
00090
if (!verifyLatestEvent(nEvt+1,EVT_ILLEGAL_MP))
00091
return;
00092 }
00093
00094
00095
if (pPL->
deviatesFromProfile((
TD_Integer)-1)) {
00096 setTestResult(
TEST_FAILURE,
"doProfileCheck(TD_Integer): unexpected failure");
00097
return;
00098 }
00099
00100
if (pPL->
deviatesFromProfile((
TD_Float)-1.0)) {
00101 setTestResult(
TEST_FAILURE,
"doProfileCheck(TD_Float): unexpected failure");
00102
return;
00103 }
00104
00105
00106
if (!pPL->
deviatesFromProfile((
TD_Integer)1)) {
00107 setTestResult(
TEST_FAILURE,
"doProfileCheck(TD_Integer): unexpected success");
00108
return;
00109 }
00110
00111
if (!pPL->
deviatesFromProfile((
TD_Float)1.0)) {
00112 setTestResult(
TEST_FAILURE,
"doProfileCheck(TD_Float): unexpected success");
00113
return;
00114 }
00115
00116
if (!pPL->
deviatesFromProfile((
TD_Integer)(listSize+rangeWidth-2))) {
00117 setTestResult(
TEST_FAILURE,
"doProfileCheck(TD_Integer): unexpected success");
00118
return;
00119 }
00120
00121
if (!pPL->
deviatesFromProfile((
TD_Float)(listSize+rangeWidth-2.0))) {
00122 setTestResult(
TEST_FAILURE,
"doProfileCheck(TD_Float): unexpected success");
00123
return;
00124 }
00125
00126 setTestResult(
TEST_SUCCESS,
"Test Successful");
00127
return;
00128 }