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_DeltaProfile.h"
00019
#include "TestCaseDeltaProfile_1.h"
00020
00021 TestCaseDeltaProfile_1::TestCaseDeltaProfile_1(
void) :
00022
TestCaseGenericSetUp(ID_DELTAPROFILE*10+1,"
TestCaseDeltaProfile_1") {
00023
return;
00024 }
00025
00026 void TestCaseDeltaProfile_1::runTestCase(
void) {
00027
00028
DC_DeltaProfile* mp =
new DC_DeltaProfile();
00029
TD_Float deltaThreshold = 2.0;
00030
TD_Integer valInt = 10;
00031
TD_Float valFloat = 5.0;
00032
00033
00034
if ( mp->
getClassId() != ID_DELTAPROFILE )
00035 { setTestResult(
TEST_FAILURE,
"Wrong class identifier");
00036
return;
00037 }
00038
00039
00040
if ( mp->
isObjectConfigured() )
00041 { setTestResult(
TEST_FAILURE,
"Wrong configuration status");
00042
return;
00043 }
00044
00045
00046 mp->
setDeltaThreshold(deltaThreshold);
00047
if ( mp->
getDeltaThreshold() != deltaThreshold )
00048 { setTestResult(
TEST_FAILURE,
"Wrong delta threshold value");
00049
return;
00050 }
00051
00052
00053
if ( !mp->
isObjectConfigured() )
00054 { setTestResult(
TEST_FAILURE,
"Wrong configuration status");
00055
return;
00056 }
00057
00058
00059
00060
if ( mp->
deviatesFromProfile(valFloat) )
00061 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00062
return;
00063 }
00064
if ( mp->
deviatesFromProfile(valFloat+deltaThreshold-(
TD_Float)0.1) )
00065 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00066
return;
00067 }
00068
00069
00070
00071
if ( mp->
deviatesFromProfile(valFloat) )
00072 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00073
return;
00074 }
00075
if ( !mp->
deviatesFromProfile(valFloat+deltaThreshold+(
TD_Float)0.1) )
00076 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00077
return;
00078 }
00079
00080
00081
if ( mp->
deviatesFromProfile(valFloat+deltaThreshold+(
TD_Float)0.1) )
00082 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00083
return;
00084 }
00085 mp->
reset();
00086
if ( mp->
deviatesFromProfile(valFloat) )
00087 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00088
return;
00089 }
00090
00091
00092
00093 mp->
reset();
00094
if ( mp->
deviatesFromProfile(valInt) )
00095 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00096
return;
00097 }
00098
if ( mp->
deviatesFromProfile(valInt+deltaThreshold-1) )
00099 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00100
return;
00101 }
00102
00103
00104
00105
if ( mp->
deviatesFromProfile(valInt) )
00106 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00107
return;
00108 }
00109
if ( !mp->
deviatesFromProfile(valInt+deltaThreshold+1) )
00110 { setTestResult(
TEST_FAILURE,
"Wrong monitoring check result");
00111
return;
00112 }
00113
00114 setTestResult(
TEST_SUCCESS,
"Test Successful");
00115
return;
00116
00117 }