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

TestCaseInRangeProfile_1.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseInRangeProfile_1.cpp 00005 // 00006 // Version 1.2 00007 // Date 11.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_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 // Check the value of the class identifier 00032 if ( mp->getClassId() != ID_INRANGEPROFILE ) 00033 { setTestResult(TEST_FAILURE, "Wrong class identifier"); 00034 return; 00035 } 00036 00037 // Check configuration status 00038 if ( mp->isObjectConfigured() ) 00039 { setTestResult(TEST_FAILURE, "Wrong configuration status"); 00040 return; 00041 } 00042 00043 // Set the lower bound 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 // Set the upper bound 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 // Check configuration status 00063 if ( !mp->isObjectConfigured() ) 00064 { setTestResult(TEST_FAILURE, "Wrong configuration status"); 00065 return; 00066 } 00067 00068 // Check monitoring check for a case with "no deviation from profile" 00069 if ( mp->deviatesFromProfile(lb-1) ) 00070 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00071 return; 00072 } 00073 00074 // Check monitoring check for a case with "deviation from profile" 00075 if ( !mp->deviatesFromProfile((lb+ub)/2) ) 00076 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00077 return; 00078 } 00079 00080 // Disable monitoring profile and repeat check 00081 mp->setEnabled(DISABLED); 00082 if ( mp->deviatesFromProfile((lb+ub)/2) ) 00083 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00084 return; 00085 } 00086 00087 // Enabble and check monitoring check for a case with "no deviation from profile" 00088 mp->setEnabled(ENABLED); 00089 if ( mp->deviatesFromProfile((lb-1)) ) 00090 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00091 return; 00092 } 00093 00094 // Check monitoring check for a case with "deviation from profile" 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 }
Copyright 2003 P&P Software GmbH - All Rights Reserved