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/TestConstants.h"
00017
#include "../GeneralInclude/Constants.h"
00018
#include "../FDIR/DC_InRangeProfile.h"
00019
#include "../FDIR/RangeProfile.h"
00020
#include "TestCaseInRangeProfile_1.h"
00021
00022 TestCaseInRangeProfile_1::TestCaseInRangeProfile_1(
void) :
00023
TestCaseGenericSetUp(ID_INRANGEPROFILE*10+1,"
TestCaseInRangeProfile_1") {
00024
return;
00025 }
00026
00027 void TestCaseInRangeProfile_1::runTestCase(
void) {
00028
00029
DC_InRangeProfile* mp =
new DC_InRangeProfile();
00030
00031
00032
if ( mp->
getClassId() != ID_INRANGEPROFILE )
00033 { setTestResult(
TEST_FAILURE,
"Wrong class identifier");
00034
return;
00035 }
00036
00037
00038
if ( mp->
isObjectConfigured() )
00039 { setTestResult(
TEST_FAILURE,
"Wrong configuration status");
00040
return;
00041 }
00042
00043
00044
TD_Float lb = 10.0;
00045 mp->
setLowerBound(lb);
00046
TD_Float ret = mp->
getLowerBound();
00047
TD_Float eps = (
TD_Float)0.00001;
00048
if ( ((ret-lb)>eps) || ((lb-ret)>eps) )
00049 { setTestResult(
TEST_FAILURE,
"Wrong lower bound value");
00050
return;
00051 }
00052
00053
00054
TD_Float ub = (
TD_Float)12.0;
00055 mp->
setUpperBound(ub);
00056 ret = mp->
getUpperBound();
00057
if ( ((ret-ub)>eps) || ((ub-ret)>eps) )
00058 { setTestResult(
TEST_FAILURE,
"Wrong lower bound value");
00059
return;
00060 }
00061
00062
00063
if ( !mp->
isObjectConfigured() )
00064 { setTestResult(
TEST_FAILURE,
"Wrong configuration status");
00065
return;
00066 }
00067
00068
00069
if ( mp->
deviatesFromProfile(lb-1) )
00070 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00071
return;
00072 }
00073
00074
00075
if ( !mp->
deviatesFromProfile((lb+ub)/2) )
00076 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00077
return;
00078 }
00079
00080
00081 mp->
setEnabled(
DISABLED);
00082
if ( mp->
deviatesFromProfile((lb+ub)/2) )
00083 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00084
return;
00085 }
00086
00087
00088 mp->
setEnabled(
ENABLED);
00089
if ( mp->
deviatesFromProfile((lb-1)) )
00090 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00091
return;
00092 }
00093
00094
00095
if ( !mp->
deviatesFromProfile((lb+ub)/2) )
00096 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00097
return;
00098 }
00099
00100 setTestResult(
TEST_SUCCESS,
"Test Successful");
00101
return;
00102
00103 }