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

TestCaseForbiddenValueProfile_1.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseForbiddenValueProfile_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_ForbiddenValueProfile.h" 00020 #include "TestCaseForbiddenValueProfile_1.h" 00021 00022 TestCaseForbiddenValueProfile_1::TestCaseForbiddenValueProfile_1(void) : 00023 TestCaseGenericSetUp(ID_FORBIDDENVALUEPROFILE*10+1,"TestCaseForbiddenValueProfile_1") { 00024 return; 00025 } 00026 00027 void TestCaseForbiddenValueProfile_1::runTestCase(void) { 00028 00029 DC_ForbiddenValueProfile* mp = new DC_ForbiddenValueProfile(); 00030 00031 // Check the value of the class identifier 00032 if ( mp->getClassId() != ID_FORBIDDENVALUEPROFILE ) 00033 { setTestResult(TEST_FAILURE, "Wrong class identifier"); 00034 return; 00035 } 00036 00037 // Set the forbidden value 00038 TD_Integer fv = 10; 00039 mp->setForbiddenValue(fv); 00040 if ( mp->getForbiddenValue() != fv ) 00041 { setTestResult(TEST_FAILURE, "Wrong forbidden value"); 00042 return; 00043 } 00044 00045 // Check monitoring check for a case with "no deviation from profile" 00046 if ( mp->deviatesFromProfile((TD_Integer)(fv+1)) ) 00047 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00048 return; 00049 } 00050 00051 // Check monitoring check for a case with "deviation from profile" 00052 if ( !mp->deviatesFromProfile(fv) ) 00053 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00054 return; 00055 } 00056 00057 // Disable monitoring profile and repeat check 00058 mp->setEnabled(DISABLED); 00059 if ( mp->deviatesFromProfile(fv) ) 00060 { setTestResult(TEST_FAILURE, "Wrong monitoring check result"); 00061 return; 00062 } 00063 mp->setEnabled(ENABLED); 00064 00065 // Check monitoring check for real-valued argument 00066 if (isNonNominalCheckAllowed()) { 00067 if ( !mp->deviatesFromProfile((TD_Float)1.0) ) 00068 { setTestResult(TEST_FAILURE, "Wrong monitoring check result for real-valued argument"); 00069 return; 00070 } 00071 } 00072 00073 setTestResult(TEST_SUCCESS,"Test Successful"); 00074 return; 00075 00076 }
Copyright 2003 P&P Software GmbH - All Rights Reserved