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

TestCaseStuckDataProfile_1.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseStuckDataProfile_1.cpp 00005 // 00006 // Version 1.1 00007 // Date 11.01.03 (Version 1.0) 00008 // 01.10.03 (Version 1.1) 00009 // Author A. Pasetti (P&P Software), R. Totaro 00010 // 00011 // Change Record: 00012 // Version 1.1: 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/MonitoringProfile.h" 00019 #include "../FDIR/DC_StuckDataProfile.h" 00020 #include "../Event/DC_EventRepository.h" 00021 #include "TestCaseStuckDataProfile_1.h" 00022 00023 TestCaseStuckDataProfile_1::TestCaseStuckDataProfile_1(void) : 00024 TestCaseGenericSetUp(ID_STUCKDATAPROFILE*10+1,"TestCaseStuckDataProfile_1") { 00025 return; 00026 } 00027 00028 void TestCaseStuckDataProfile_1::runTestCase(void) { 00029 00030 DC_StuckDataProfile* mp = new DC_StuckDataProfile(); 00031 unsigned int stuckThreshold = 2; 00032 TD_Integer sv = 10; 00033 00034 // Check the value of the class identifier 00035 if ( mp->getClassId() != ID_STUCKDATAPROFILE ) 00036 { setTestResult(TEST_FAILURE, "Wrong class identifier"); 00037 return; 00038 } 00039 00040 // Check configuration status 00041 if ( mp->isObjectConfigured() ) 00042 { setTestResult(TEST_FAILURE, "Wrong configuration status"); 00043 return; 00044 } 00045 00046 // Set the stuck threshold 00047 mp->setStuckThreshold(stuckThreshold); 00048 if ( mp->getStuckThreshold() != stuckThreshold ) 00049 { setTestResult(TEST_FAILURE, "Wrong stuck threshold value"); 00050 return; 00051 } 00052 00053 // Check configuration status 00054 if ( !mp->isObjectConfigured() ) 00055 { setTestResult(TEST_FAILURE, "Wrong configuration status"); 00056 return; 00057 } 00058 00059 // Check monitoring check for a case with "no deviation from profile" 00060 if ( mp->deviatesFromProfile(sv) ) 00061 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00062 return; 00063 } 00064 if ( mp->deviatesFromProfile(sv) ) 00065 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00066 return; 00067 } 00068 if ( mp->deviatesFromProfile((TD_Integer)(sv+1)) ) 00069 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00070 return; 00071 } 00072 00073 // Check monitoring check for a case with "deviation from profile" 00074 if ( mp->deviatesFromProfile(sv) ) 00075 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00076 return; 00077 } 00078 if ( mp->deviatesFromProfile(sv) ) 00079 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00080 return; 00081 } 00082 if ( !mp->deviatesFromProfile(sv) ) 00083 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00084 return; 00085 } 00086 00087 // Check the effect of resetting the monitoring check 00088 if ( mp->deviatesFromProfile((TD_Integer)(sv+1)) ) 00089 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00090 return; 00091 } 00092 if ( mp->deviatesFromProfile((TD_Integer)(sv+1)) ) 00093 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00094 return; 00095 } 00096 mp->reset(); 00097 if ( mp->deviatesFromProfile((TD_Integer)(sv+1)) ) 00098 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00099 return; 00100 } 00101 if ( mp->deviatesFromProfile((TD_Integer)(sv+1)) ) 00102 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00103 return; 00104 } 00105 if ( !mp->deviatesFromProfile((TD_Integer)(sv+1)) ) 00106 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00107 return; 00108 } 00109 00110 // Check monitoring check for real-valued argument 00111 if (isNonNominalCheckAllowed()) { 00112 if ( !mp->deviatesFromProfile((TD_Float)1.0) ) 00113 { setTestResult(TEST_FAILURE, "Wrong monitoring check result for real-valued argument"); 00114 return; 00115 } 00116 } 00117 00118 setTestResult(TEST_SUCCESS,"Test Successful"); 00119 return; 00120 00121 }
Copyright 2003 P&P Software GmbH - All Rights Reserved