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

TestCaseDummyCriticalTelecommand_1.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // TestCaseDummyCriticalTelecommand_1.cpp 00005 // 00006 // Version 1.0 00007 // Date 17.06.03 00008 // Author R. Totaro 00009 00010 #include "../GeneralInclude/CompilerSwitches.h" 00011 #include "../GeneralInclude/ClassId.h" 00012 #include "../GeneralInclude/Constants.h" 00013 #include "../GeneralInclude/TestConstants.h" 00014 #include "../System/DC_DummyObsClock.h" 00015 #include "../Telecommand/DC_DummyCriticalTelecommand.h" 00016 #include "TestCaseDummyCriticalTelecommand_1.h" 00017 00018 TestCaseDummyCriticalTelecommand_1::TestCaseDummyCriticalTelecommand_1(void) : 00019 TestCaseGenericSetUp(ID_DUMMYCRITICALTELECOMMAND*10+1, 00020 "TestCaseDummyCriticalTelecommand_1") { 00021 return; 00022 } 00023 00024 void TestCaseDummyCriticalTelecommand_1::runTestCase(void) { 00025 const TD_ObsTime timeTag =0; 00026 const TD_ObsTime maxArmedDuration=10; 00027 ObsClock *pObsClk =new DC_DummyObsClock(); 00028 DC_DummyCriticalTelecommand *pTC =new DC_DummyCriticalTelecommand(); 00029 00030 // Verify the correctness of the class id 00031 if (pTC->getClassId()!=ID_DUMMYCRITICALTELECOMMAND) { 00032 setTestResult(TEST_FAILURE,"Wrong class id"); 00033 return; 00034 } 00035 00036 // The following will configure CriticalTelecommand's base class... 00037 pTC->setTimeTag(timeTag); 00038 00039 // ...however CriticalTelecommand shall still be unconfigured 00040 if (pTC->isObjectConfigured()) { 00041 setTestResult(TEST_FAILURE,"Newly created object is configured"); 00042 return; 00043 } 00044 00045 // Let's set the armed duration and verify that the TC is not yet configured 00046 pTC->setMaxArmedDuration(maxArmedDuration); 00047 if (pTC->isObjectConfigured()) { 00048 setTestResult(TEST_FAILURE,"Wrong configuration status"); 00049 return; 00050 } 00051 00052 // Verify that the max armed duration was properly set 00053 if (pTC->getMaxArmedDuration()!=maxArmedDuration) { 00054 setTestResult(TEST_FAILURE,"getMaxArmedDuration() failed"); 00055 return; 00056 } 00057 00058 // After this the TC shall be configured 00059 pTC->setObsClock(pObsClk); 00060 if (!pTC->isObjectConfigured()) { 00061 setTestResult(TEST_FAILURE,"Wrong configuration status"); 00062 return; 00063 } 00064 00065 // Verify that the ObsClock pointer was properly set 00066 if (pTC->getObsClock()!=pObsClk) { 00067 setTestResult(TEST_FAILURE,"getObsClock() failed"); 00068 return; 00069 } 00070 00071 // A newly created TC shall be critical... 00072 if (!pTC->isCritical()) { 00073 setTestResult(TEST_FAILURE,"Newly created TC is critical"); 00074 return; 00075 } 00076 00077 // ...and should not be armed 00078 if (pTC->isArmed()) { 00079 setTestResult(TEST_FAILURE,"Newly created TC is armed"); 00080 return; 00081 } 00082 00083 // Let's verify that we can change the criticality level 00084 pTC->setCriticalityLevel(false); 00085 if (pTC->isCritical()) { 00086 setTestResult(TEST_FAILURE,"setCriticalityLevel() failed"); 00087 return; 00088 } 00089 00090 // Verify that isImageValid() and setImageValidity() work as expected 00091 if (pTC->isImageValid()) { 00092 setTestResult(TEST_FAILURE,"The image of a newly created TC is valid"); 00093 return; 00094 } 00095 00096 pTC->setImageValidity(true); 00097 if (!pTC->isImageValid()) { 00098 setTestResult(TEST_FAILURE,"setImageValidity() failed"); 00099 return; 00100 } 00101 00102 // Verify that the "time when armed" is invalid 00103 if (pTC->getTimeWhenArmed()>=0) { 00104 setTestResult(TEST_FAILURE,"Wrong initial \"time when armed\""); 00105 return; 00106 } 00107 00108 setTestResult(TEST_SUCCESS,"Test Successful"); 00109 return; 00110 }
Copyright 2003 P&P Software GmbH - All Rights Reserved