00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
#include "TestCaseManoeuvreManager_1.h"
00011
#include "../GeneralInclude/ClassId.h"
00012
#include "../GeneralInclude/Constants.h"
00013
#include "../GeneralInclude/CompilerSwitches.h"
00014
#include "../Manoeuvre/CC_ManoeuvreManager.h"
00015
#include "../Manoeuvre/DC_DummyManoeuvre.h"
00016
00017 TestCaseManoeuvreManager_1::TestCaseManoeuvreManager_1(
void) :
00018
TestCaseWithEvtCheck(ID_MANOEUVREMANAGER*10+1,"
TestCaseManoeuvreManager_1") {
00019
return;
00020 }
00021
00022 void TestCaseManoeuvreManager_1::runTestCase(
void) {
00023
CC_ManoeuvreManager *pMM =
new CC_ManoeuvreManager();
00024
const unsigned int nEvt=
getNumberOfEvents();
00025
const unsigned int nMan=8;
00026
00027
00028
if (pMM->
getClassId()!=ID_MANOEUVREMANAGER) {
00029 setTestResult(
TEST_FAILURE,
"Wrong class identifier");
00030
return;
00031 }
00032
00033
00034
if (pMM->
isObjectConfigured()) {
00035 setTestResult(
TEST_FAILURE,
"Newly created ManoeuvreManager already configured");
00036
return;
00037 }
00038
00039
00040 pMM->
setPendingManoeuvreListSize(nMan);
00041
if (pMM->
getPendingManoeuvreListSize()!=nMan) {
00042 setTestResult(
TEST_FAILURE,
"Wrong getPendingManoeuvreListSize return value");
00043
return;
00044 }
00045
00046
00047
if (!pMM->
isObjectConfigured()) {
00048 setTestResult(
TEST_FAILURE,
"ManoeuvreManager not configured");
00049
return;
00050 }
00051
00052
00053
if (pMM->
getPendingManoeuvres()!=0) {
00054 setTestResult(
TEST_FAILURE,
"Wrong getPendingManoeuvres return value");
00055
return;
00056 }
00057
00058
00059
00060
00061
DC_DummyManoeuvre *pDM[nMan+1];
00062
00063
for (
unsigned int i=0; i<=nMan; i++)
00064 pDM[i]=
new DC_DummyManoeuvre();
00065
00066
for (
unsigned int i=0;i<nMan;i++) {
00067
00068 pMM->
load(pDM[i]);
00069
00070
00071
if (pMM->
getPendingManoeuvres()!=(i+1)) {
00072 setTestResult(
TEST_FAILURE,
"manCounter was not incremented");
00073
return;
00074 }
00075
00076
00077 pDM[i]->
setInUse(
true);
00078 }
00079
00080
00081 pMM->
abort(pDM[nMan-1]);
00082
if (pMM->
getPendingManoeuvres()!=(nMan-1)) {
00083 setTestResult(
TEST_FAILURE,
"manCounter was not decremented");
00084
return;
00085 }
00086
00087
00088
if (pDM[nMan-1]->
isInUse()) {
00089 setTestResult(
TEST_FAILURE,
"Aborted manoeuvre still in use");
00090
return;
00091 }
00092
00093
00094 pMM->
load(pDM[nMan-1]);
00095
00096
00097
00098 pMM->
load(pDM[nMan]);
00099
if (!verifyLatestEvent((nEvt+nMan+3),EVT_MAN_LIST_FULL))
00100
return;
00101
00102
00103
00104 pMM->
reset();
00105
for (
int i=0;i<nMan;i++) {
00106
if (pDM[i]->
isInUse()) {
00107 setTestResult(
TEST_FAILURE,
"Reset failed to abort a manoeuvre");
00108
return;
00109 }
00110 }
00111
00112 setTestResult(
TEST_SUCCESS,
"Test Successful");
00113
return;
00114 }