00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
#include "../GeneralInclude/CompilerSwitches.h"
00013
#include "../GeneralInclude/ClassId.h"
00014
#include "../GeneralInclude/Constants.h"
00015
#include "../Data/DC_SampleFullDataPool.h"
00016
#include "../Data/DC_DataItem.h"
00017
#include "../System/DC_DummyObsClock.h"
00018
#include "../FDIR/DC_NullProfile.h"
00019
#include "../FDIR/DC_NullRecoveryAction.h"
00020
#include "TestCaseSampleFullDataPool_1.h"
00021
#include "../Utilities/TestCaseWithEvtCheck.h"
00022
00023
#include <math.h>
00024
#include <float.h>
00025
00026 TestCaseSampleFullDataPool_1::TestCaseSampleFullDataPool_1():
00027
TestCaseWithEvtCheck(ID_SAMPLEFULLDATAPOOL*10+1,"
TestCaseSampleFullDataPool_1") {
00028
return;
00029 }
00030
00031 void TestCaseSampleFullDataPool_1::runTestCase() {
00032
00033
00034
unsigned int nEvt;
00035 nEvt =
getNumberOfEvents();
00036
00037
00038
TD_DataPoolId numberOfPar = 8;
00039
00040
00041
TD_DataPoolId firstRealId = 2;
00042
00043
00044
TD_DataPoolId firstIntegerId = 1;
00045
00046
00047
DC_SampleFullDataPool* pDP =
new DC_SampleFullDataPool();
00048
00049
00050
TD_DataPoolId maxParId;
00051 maxParId = 11;
00052
00053
00054
TD_DataPoolId id;
00055
id = 0;
00056
00057
00058
TD_DataPoolId lowestIllegalParId;
00059 lowestIllegalParId = (
TD_DataPoolId)3;
00060
00061
00062
if (pDP->
getClassId() != ID_SAMPLEFULLDATAPOOL)
00063 { setTestResult(
TEST_FAILURE,
"Wrong class ID");
00064
return;
00065 }
00066
00067
00068
00069
if ( !pDP->
isValid(1) )
00070 { setTestResult(
TEST_FAILURE,
"Wrong default validity status on data item 1");
00071
return;
00072 }
00073
00074
if ( !pDP->
isValid(2) )
00075 { setTestResult(
TEST_FAILURE,
"Wrong default validity status on data item 2");
00076
return;
00077 }
00078
00079
if ( !pDP->
isValid(4) )
00080 { setTestResult(
TEST_FAILURE,
"Wrong default validity status on data item 4");
00081
return;
00082 }
00083
00084
if ( !pDP->
isValid(5) )
00085 { setTestResult(
TEST_FAILURE,
"Wrong default validity status on data item 5");
00086
return;
00087 }
00088
00089
if ( !pDP->
isValid(7) )
00090 { setTestResult(
TEST_FAILURE,
"Wrong default validity status on data item 7");
00091
return;
00092 }
00093
00094
if ( !pDP->
isValid(8) )
00095 { setTestResult(
TEST_FAILURE,
"Wrong default validity status on data item 8");
00096
return;
00097 }
00098
00099
if ( !pDP->
isValid(10) )
00100 { setTestResult(
TEST_FAILURE,
"Wrong default validity status on data item 10");
00101
return;
00102 }
00103
00104
if ( !pDP->
isValid(11) )
00105 { setTestResult(
TEST_FAILURE,
"Wrong default validity status on data item 11");
00106
return;
00107 }
00108
00109
00110
if ( pDP->
isObjectConfigured() !=
NOT_CONFIGURED )
00111 { setTestResult(
TEST_FAILURE,
"Incorrect configuration status at creation");
00112
return;
00113 }
00114
00115
00116
DC_DummyObsClock* pClk =
new DC_DummyObsClock();
00117
TD_ObsTime time = (
TD_ObsTime)10;
00118 pClk->
setTime(time);
00119 pClk->
setCycle(0);
00120 pDP->
setObsClock(pClk);
00121
if ( pDP->
getObsClock() != pClk )
00122 { setTestResult(
TEST_FAILURE,
"Incorrect OBS Clock");
00123
return;
00124 }
00125
00126
00127
if ( pDP->
isObjectConfigured() !=
NOT_CONFIGURED )
00128 { setTestResult(
TEST_FAILURE,
"Incorrect configuration status at creation");
00129
return;
00130 }
00131
00132
00133
DC_NullProfile* pNP =
new DC_NullProfile();
00134 pDP->
setMonitoringProfile(1,pNP);
00135
if (pDP->
getMonitoringProfile(1)!=pNP)
00136 { setTestResult(
TEST_FAILURE,
"Failure to read back monitoring profile");
00137
return;
00138 }
00139
00140 pDP->
setMonitoringProfile(2,pNP);
00141
if (pDP->
getMonitoringProfile(2)!=pNP)
00142 { setTestResult(
TEST_FAILURE,
"Failure to read back monitoring profile");
00143
return;
00144 }
00145
00146 pDP->
setMonitoringProfile(4,pNP);
00147
if (pDP->
getMonitoringProfile(4)!=pNP)
00148 { setTestResult(
TEST_FAILURE,
"Failure to read back monitoring profile");
00149
return;
00150 }
00151
00152 pDP->
setMonitoringProfile(5,pNP);
00153
if (pDP->
getMonitoringProfile(5)!=pNP)
00154 { setTestResult(
TEST_FAILURE,
"Failure to read back monitoring profile");
00155
return;
00156 }
00157
00158 pDP->
setMonitoringProfile(7,pNP);
00159
if (pDP->
getMonitoringProfile(7)!=pNP)
00160 { setTestResult(
TEST_FAILURE,
"Failure to read back monitoring profile");
00161
return;
00162 }
00163
00164 pDP->
setMonitoringProfile(8,pNP);
00165
if (pDP->
getMonitoringProfile(8)!=pNP)
00166 { setTestResult(
TEST_FAILURE,
"Failure to read back monitoring profile");
00167
return;
00168 }
00169
00170 pDP->
setMonitoringProfile(10,pNP);
00171
if (pDP->
getMonitoringProfile(10)!=pNP)
00172 { setTestResult(
TEST_FAILURE,
"Failure to read back monitoring profile");
00173
return;
00174 }
00175
00176 pDP->
setMonitoringProfile(11,pNP);
00177
if (pDP->
getMonitoringProfile(11)!=pNP)
00178 { setTestResult(
TEST_FAILURE,
"Failure to read back monitoring profile");
00179
return;
00180 }
00181
00182
00183
DC_NullRecoveryAction* pRA =
new DC_NullRecoveryAction();
00184 pDP->
setRecoveryAction(1,pRA);
00185
if (pDP->
getRecoveryAction(1)!=pRA)
00186 { setTestResult(
TEST_FAILURE,
"Failure to read back recovery action");
00187
return;
00188 }
00189
00190 pDP->
setRecoveryAction(2,pRA);
00191
if (pDP->
getRecoveryAction(2)!=pRA)
00192 { setTestResult(
TEST_FAILURE,
"Failure to read back recovery action");
00193
return;
00194 }
00195
00196 pDP->
setRecoveryAction(4,pRA);
00197
if (pDP->
getRecoveryAction(4)!=pRA)
00198 { setTestResult(
TEST_FAILURE,
"Failure to read back recovery action");
00199
return;
00200 }
00201
00202 pDP->
setRecoveryAction(5,pRA);
00203
if (pDP->
getRecoveryAction(5)!=pRA)
00204 { setTestResult(
TEST_FAILURE,
"Failure to read back recovery action");
00205
return;
00206 }
00207
00208 pDP->
setRecoveryAction(7,pRA);
00209
if (pDP->
getRecoveryAction(7)!=pRA)
00210 { setTestResult(
TEST_FAILURE,
"Failure to read back recovery action");
00211
return;
00212 }
00213
00214 pDP->
setRecoveryAction(8,pRA);
00215
if (pDP->
getRecoveryAction(8)!=pRA)
00216 { setTestResult(
TEST_FAILURE,
"Failure to read back recovery action");
00217
return;
00218 }
00219
00220 pDP->
setRecoveryAction(10,pRA);
00221
if (pDP->
getRecoveryAction(10)!=pRA)
00222 { setTestResult(
TEST_FAILURE,
"Failure to read back recovery action");
00223
return;
00224 }
00225
00226 pDP->
setRecoveryAction(11,pRA);
00227
if (pDP->
getRecoveryAction(11)!=pRA)
00228 { setTestResult(
TEST_FAILURE,
"Failure to read back recovery action");
00229
return;
00230 }
00231
00232
00233
if ( pDP->
isObjectConfigured() !=
CONFIGURED )
00234 { setTestResult(
TEST_FAILURE,
"Incorrect configuration status");
00235
return;
00236 }
00237
00238
00239
00240
00241
id = 2;
00242 pDP->
setValue(
id,(
TD_Float)
id);
00243
if ( fabs((
float)(pDP->
getFloatValue(
id)-
id))>FLT_EPSILON )
00244 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00245
return;
00246 }
00247
if ( fabs((
float)((*pDP->
getPointerFloatValue(
id))-
id))>FLT_EPSILON )
00248 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00249
return;
00250 }
00251
id = 5;
00252 pDP->
setValue(
id,(
TD_Float)
id);
00253
if ( fabs((
float)(pDP->
getFloatValue(
id)-
id))>FLT_EPSILON )
00254 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00255
return;
00256 }
00257
if ( fabs((
float)((*pDP->
getPointerFloatValue(
id))-
id))>FLT_EPSILON )
00258 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00259
return;
00260 }
00261
id = 8;
00262 pDP->
setValue(
id,(
TD_Float)
id);
00263
if ( fabs((
float)(pDP->
getFloatValue(
id)-
id))>FLT_EPSILON )
00264 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00265
return;
00266 }
00267
if ( fabs((
float)((*pDP->
getPointerFloatValue(
id))-
id))>FLT_EPSILON )
00268 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00269
return;
00270 }
00271
id = 11;
00272 pDP->
setValue(
id,(
TD_Float)
id);
00273
if ( fabs((
float)(pDP->
getFloatValue(
id)-
id))>FLT_EPSILON )
00274 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00275
return;
00276 }
00277
if ( fabs((
float)((*pDP->
getPointerFloatValue(
id))-
id))>FLT_EPSILON )
00278 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00279
return;
00280 }
00281
id = 1;
00282 pDP->
setValue(
id,(
TD_Integer)
id);
00283
if ( pDP->
getIntegerValue(
id)!=
id )
00284 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00285
return;
00286 }
00287
if ( (*pDP->
getPointerIntegerValue(
id))!=
id )
00288 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00289
return;
00290 }
00291
id = 4;
00292 pDP->
setValue(
id,(
TD_Integer)
id);
00293
if ( pDP->
getIntegerValue(
id)!=
id )
00294 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00295
return;
00296 }
00297
if ( (*pDP->
getPointerIntegerValue(
id))!=
id )
00298 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00299
return;
00300 }
00301
id = 7;
00302 pDP->
setValue(
id,(
TD_Integer)
id);
00303
if ( pDP->
getIntegerValue(
id)!=
id )
00304 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00305
return;
00306 }
00307
if ( (*pDP->
getPointerIntegerValue(
id))!=
id )
00308 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00309
return;
00310 }
00311
id = 10;
00312 pDP->
setValue(
id,(
TD_Integer)
id);
00313
if ( pDP->
getIntegerValue(
id)!=
id )
00314 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00315
return;
00316 }
00317
if ( (*pDP->
getPointerIntegerValue(
id))!=
id )
00318 { setTestResult(
TEST_FAILURE,
"Failure to read back data pool item with ID: id");
00319
return;
00320 }
00321
00322
if ( pDP->
getTimeStamp(1)!=time )
00323 { setTestResult(
TEST_FAILURE,
"Wrong time stamp");
00324
return;
00325 }
00326
00327
00328
id = 1;
00329 pDP->
setValidityStatus(
id,
false);
00330
if ( pDP->
isValid(
id) )
00331 { setTestResult(
TEST_FAILURE,
"Wrong validity status");
00332
return;
00333 }
00334
00335
00336
if (
isNonNominalCheckAllowed()) {
00337 pDP->
setValidityStatus(11+1,
false);
00338
if ( !verifyLatestEvent(nEvt+1,EVT_ILLEGAL_DP_ACCESS) )
00339
return;
00340 nEvt = nEvt+1;
00341 }
00342
00343
00344
id = 1;
00345 pDP->
setValidityStatus(
id,
false);
00346 pDP->
reset();
00347
if ( !pDP->
isValid(
id) )
00348 { setTestResult(
TEST_FAILURE,
"Reset failure");
00349
return;
00350 }
00351
00352
00353
00354
id = 1;
00355
TD_Integer oldValue = pDP->
getIntegerValue(
id);
00356 pDP->
setValidityStatus(
id,
false);
00357 pDP->
setValue(
id,(
TD_Integer)(oldValue+1));
00358
if ( pDP->
getIntegerValue(
id)!=oldValue )
00359 { setTestResult(
TEST_FAILURE,
"Back-up value failure");
00360
return;
00361 }
00362
if ( pDP->
getDataItem(
id)->
getIntegerValue()!=oldValue )
00363 { setTestResult(
TEST_FAILURE,
"Back-up value failure");
00364
return;
00365 }
00366 pDP->
setValidityStatus(
id,
true);
00367 pDP->
setValue(
id,(
TD_Integer)(oldValue+1));
00368
if ( pDP->
getIntegerValue(
id)!=(oldValue+1) )
00369 { setTestResult(
TEST_FAILURE,
"Back-up value failure");
00370
return;
00371 }
00372
if ( pDP->
getDataItem(
id)->
getIntegerValue()!=(oldValue+1) )
00373 { setTestResult(
TEST_FAILURE,
"Back-up value failure");
00374
return;
00375 }
00376
00377
00378
id = 2;
00379
TD_Float fOldValue = pDP->
getFloatValue(
id);
00380 pDP->
setValidityStatus(
id,
false);
00381 pDP->
setValue(
id,(
TD_Float)(fOldValue+1.0));
00382
if ( fabs( (
float)(pDP->
getFloatValue(
id)-fOldValue) )>FLT_EPSILON )
00383 { setTestResult(
TEST_FAILURE,
"Back-up value failure");
00384
return;
00385 }
00386 pDP->
setValidityStatus(
id,
true);
00387 pDP->
setValue(
id,(
TD_Float)(fOldValue+1.0));
00388
if ( fabs( (
float)(pDP->
getFloatValue(
id)-(fOldValue+1.0)) )>FLT_EPSILON )
00389 { setTestResult(
TEST_FAILURE,
"Back-up value failure");
00390
return;
00391 }
00392
00393
00394
TD_DataPoolId counter = 0;
00395
for (
TD_DataPoolId i=pDP->
firstIdentifier(); !pDP->
isLastIdentifier(); i=pDP->
nextIdentifier()) {
00396 counter++;
00397 pDP->
setValidityStatus(i,
false);
00398 }
00399
if ( counter!=numberOfPar )
00400 { setTestResult(
TEST_FAILURE,
"Error in data pool iteration");
00401
return;
00402 }
00403
00404
if ( !pDP->
isFloat(firstRealId) || pDP->
isInteger(firstRealId) )
00405 { setTestResult(
TEST_FAILURE,
"Error in type checking service");
00406
return;
00407 }
00408
if ( !pDP->
isInteger(firstIntegerId) || pDP->
isFloat(firstIntegerId) )
00409 { setTestResult(
TEST_FAILURE,
"Error in type checking service");
00410
return;
00411 }
00412
00413 setTestResult(
TEST_SUCCESS,
"Test Successful");
00414
return;
00415 }