Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

TestCaseDeltaProfile_1.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseDeltaProfile_1.cpp 00005 // 00006 // Version 1.2 00007 // Date 18.04.03 (Version 1.1) 00008 // 01.10.03 (Version 1.2) 00009 // Author A. Pasetti (P&P Software), R. Totaro 00010 // 00011 // Change Record: 00012 // Version 1.2: replaced double and int with TD_Float and TD_Integer 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 // Check the value of the class identifier 00034 if ( mp->getClassId() != ID_DELTAPROFILE ) 00035 { setTestResult(TEST_FAILURE, "Wrong class identifier"); 00036 return; 00037 } 00038 00039 // Check configuration status 00040 if ( mp->isObjectConfigured() ) 00041 { setTestResult(TEST_FAILURE, "Wrong configuration status"); 00042 return; 00043 } 00044 00045 // Set the delta threshold 00046 mp->setDeltaThreshold(deltaThreshold); 00047 if ( mp->getDeltaThreshold() != deltaThreshold ) 00048 { setTestResult(TEST_FAILURE, "Wrong delta threshold value"); 00049 return; 00050 } 00051 00052 // Check configuration status 00053 if ( !mp->isObjectConfigured() ) 00054 { setTestResult(TEST_FAILURE, "Wrong configuration status"); 00055 return; 00056 } 00057 00058 // Check monitoring check for a case with "no deviation from profile" 00059 // (argument of type double) 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 // Check monitoring check for a case with "deviation from profile" 00070 // (argument of type double) 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 // Check the effect of resetting the monitoring check 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 // Check monitoring check for a case with "no deviation from profile 00092 // (argument of type int) 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 // Check monitoring check for a case with "deviation from profile" 00104 // (argument of type int) 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 }
Copyright 2003 P&P Software GmbH - All Rights Reserved