1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/centralrepository/test/t_cenrep_perf.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1318 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <centralrepository.h>
1.20 +#include <e32test.h>
1.21 +#include <f32file.h>
1.22 +#include <bautils.h>
1.23 +#include <hal.h>
1.24 +
1.25 +RTest TheTest(_L("t_cenrep_perf test"));
1.26 +CRepository* TheRepository = NULL;
1.27 +const TUid KTestCenRepUid = {0xCCCCCC03};
1.28 +_LIT(KFileName, "c:\\private\\10202be9\\persists\\cccccc03.cre");
1.29 +
1.30 +///////////////////////////////////////////////////////////////////////////////////////
1.31 +
1.32 +// Shared test data
1.33 +
1.34 +enum TValType {EIntVal, ERealVal, EBinaryVal, EStringVal, EMetaVal};
1.35 +enum TTestType {ESetTest, ECreateTest, EFindEqTest, EFindNeqTest, EResetTest};
1.36 +
1.37 +// int
1.38 +const TUint32 KIntKey = 42011136ul;
1.39 +const TUint32 KNewIntKey = 2374040320ul;
1.40 +const TUint32 KNewIntKey2 = 2374040576ul;
1.41 +const TInt KOldIntVal = 10;
1.42 +const TInt KNewIntVal = KOldIntVal + 1;
1.43 +const TUint32 KIntMeta = 0;
1.44 +
1.45 +// real
1.46 +const TUint32 KRealKey = 2374041088ul;
1.47 +const TUint32 KNewRealKey = 2374041344ul;
1.48 +const TReal KOldRealVal = 0.1;
1.49 +const TReal KNewRealVal = KOldRealVal + 1.0;
1.50 +
1.51 +// binary
1.52 +const TUint32 KBinKey = 42141952ul;
1.53 +const TUint32 KNewBinKey = 2374040832ul;
1.54 +_LIT8(KOldBinVal, "\x44\x00\x69\x00\x61\x00\x6c\x00\x4f\x00\x75\x00\x74\x00\x49\x00\x53\x00\x50\x00");
1.55 +_LIT8(KNewBinVal, "\x44\x00\x69\x00\x61\x00\x6c\x00\x4f\x00\x75\x00\x74\x00\x49\x00\x53\x00\x50\x01");
1.56 +
1.57 +// string
1.58 +const TUint32 KStrKey = 2374041600ul;
1.59 +const TUint32 KNewStrKey = 2374041856ul;
1.60 +_LIT(KOldStrVal, "hello");
1.61 +_LIT(KNewStrVal, "goodbye");
1.62 +
1.63 +
1.64 +// FindL range data
1.65 +const TUint32 KFindPartialKey = 0x08440000ul;
1.66 +const TUint32 KFindMask = 0x0FFF0000ul;
1.67 +const TInt KFindKeyCount = 15;
1.68 +
1.69 +
1.70 +///////////////////////////////////////////////////////////////////////////////////////
1.71 +
1.72 +TInt DeleteCreFile()
1.73 + {
1.74 + RFs fs;
1.75 + fs.Connect();
1.76 + TInt err = fs.Delete(KFileName);
1.77 + fs.Close();
1.78 +
1.79 + // it's fine if the file or path wasn't found as there's nothing to
1.80 + // delete so return KErrNone
1.81 + return (err == KErrNotFound || err == KErrPathNotFound) ? KErrNone : err;
1.82 + }
1.83 +
1.84 +///////////////////////////////////////////////////////////////////////////////////////
1.85 +
1.86 +void DestroyTestEnv()
1.87 + {
1.88 + delete TheRepository;
1.89 +
1.90 + // delete the CRE file to clear out any changes made during the test
1.91 + DeleteCreFile();
1.92 + }
1.93 +
1.94 +///////////////////////////////////////////////////////////////////////////////////////
1.95 +
1.96 +//Test macros and functions
1.97 +void Check(TInt aValue, TInt aLine)
1.98 + {
1.99 + if(!aValue)
1.100 + {
1.101 + DestroyTestEnv();
1.102 + RDebug::Print(_L("*** Test failure. Boolean expression evaluates to false.\r\n"));
1.103 + TheTest(EFalse, aLine);
1.104 + }
1.105 + }
1.106 +void Check2(TInt aValue, TInt aExpected, TInt aLine)
1.107 + {
1.108 + if(aValue != aExpected)
1.109 + {
1.110 + DestroyTestEnv();
1.111 + RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
1.112 + TheTest(EFalse, aLine);
1.113 + }
1.114 + }
1.115 +#define TEST(arg) ::Check((arg), __LINE__)
1.116 +#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
1.117 +
1.118 +///////////////////////////////////////////////////////////////////////////////////////
1.119 +
1.120 +// leaves if it can't successfully delete the cre file if it exists
1.121 +void CreateTestEnvL()
1.122 + {
1.123 + // delete the CRE file to clear out any changes leftover from previous test runs
1.124 + User::LeaveIfError(DeleteCreFile());
1.125 +
1.126 + TRAPD(err, TheRepository = CRepository::NewL(KTestCenRepUid));
1.127 + TEST2(err, KErrNone);
1.128 + }
1.129 +
1.130 +
1.131 +//Prints aTicks parameter (converted to us)
1.132 +void PrintStats(TUint32 aStartTicks, TUint32 aEndTicks)
1.133 + {
1.134 + static TInt freq = 0;
1.135 + if(freq == 0)
1.136 + {
1.137 + TEST2(HAL::Get(HAL::EFastCounterFrequency, freq), KErrNone);
1.138 + }
1.139 + TInt64 diffTicks = (TInt64)aEndTicks - (TInt64)aStartTicks;
1.140 + if(diffTicks < 0)
1.141 + {
1.142 + diffTicks = KMaxTUint32 + diffTicks + 1;
1.143 + }
1.144 + const TInt KMicroSecIn1Sec = 1000000;
1.145 + TInt32 us = (diffTicks * KMicroSecIn1Sec) / freq;
1.146 + TheTest.Printf(_L("####Execution time: %d us\r\n"), us);
1.147 + }
1.148 +
1.149 +///////////////////////////////////////////////////////////////////////////////////////
1.150 +
1.151 +// Utility functions containing code common to multiple test cases
1.152 +
1.153 +/**
1.154 + * Common code for calling Get() with old values
1.155 + *
1.156 + * @param aValType enum indicating which data type to test
1.157 + * (EIntVal, ERealVal, EBinaryVal, EStringVal or EMetaVal-- any other value will return KErrArgument).
1.158 + * @param aResult bool indicating whether the comparison was successful
1.159 + * @return err code from Get()
1.160 + */
1.161 +TInt GetOldVal(TValType aValType, TBool& aResult)
1.162 + {
1.163 + TInt intVal(0);
1.164 + TReal realVal(0.0);
1.165 + TBuf8<100> binVal;
1.166 + TBuf16<100> strVal;
1.167 + TUint32 metaVal(0);
1.168 +
1.169 + TInt err(KErrNone);
1.170 +
1.171 + switch (aValType)
1.172 + {
1.173 + case EIntVal:
1.174 + err = TheRepository->Get(KIntKey, intVal);
1.175 + aResult = (intVal == KOldIntVal);
1.176 + break;
1.177 +
1.178 + case ERealVal:
1.179 + err = TheRepository->Get(KRealKey, realVal);
1.180 + aResult = (realVal == KOldRealVal);
1.181 + break;
1.182 +
1.183 + case EBinaryVal:
1.184 + err = TheRepository->Get(KBinKey, binVal);
1.185 + aResult = (binVal == KOldBinVal);
1.186 + break;
1.187 +
1.188 + case EStringVal:
1.189 + err = TheRepository->Get(KStrKey, strVal);
1.190 + aResult = (strVal == KOldStrVal);
1.191 + break;
1.192 +
1.193 + case EMetaVal:
1.194 + err = TheRepository->GetMeta(KIntKey, metaVal);
1.195 + aResult = (metaVal == KIntMeta);
1.196 + break;
1.197 +
1.198 + default:
1.199 + err = KErrArgument;
1.200 + break;
1.201 + }
1.202 + return err;
1.203 + }
1.204 +
1.205 +
1.206 +/**
1.207 + * Common code for calling Get() with new values
1.208 + *
1.209 + * @param aValType enum indicating which data type to test
1.210 + * (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will return KErrArgument).
1.211 + * @param aTestType enum defining whether Set() or Create() is being tested
1.212 + * (ESetTest or ECreateTest -- anything else will return KErrArgument).
1.213 + * @param aResult bool indicating whether the comparison was successful
1.214 + * @return err code from Get()
1.215 + */
1.216 +TInt GetNewVal(TValType aValType, TTestType aTestType, TBool& aResult)
1.217 + {
1.218 + // check correct test type
1.219 + if (aTestType != ECreateTest && aTestType != ESetTest)
1.220 + {
1.221 + return KErrArgument;
1.222 + }
1.223 +
1.224 + TInt intVal(0);
1.225 + TReal realVal(0.0);
1.226 + TBuf8<100> binVal;
1.227 + TBuf16<100> strVal;
1.228 +
1.229 + TInt err(KErrNone);
1.230 +
1.231 + switch (aValType)
1.232 + {
1.233 + case EIntVal:
1.234 + err = TheRepository->Get(
1.235 + (aTestType == ECreateTest ? KNewIntKey : KIntKey), intVal);
1.236 + aResult = (intVal == KNewIntVal);
1.237 + break;
1.238 +
1.239 + case ERealVal:
1.240 + err = TheRepository->Get(
1.241 + (aTestType == ECreateTest ? KNewRealKey : KRealKey), realVal);
1.242 + aResult = (realVal == KNewRealVal);
1.243 + break;
1.244 +
1.245 + case EBinaryVal:
1.246 + err = TheRepository->Get(
1.247 + (aTestType == ECreateTest ? KNewBinKey : KBinKey), binVal);
1.248 + aResult = (binVal == KNewBinVal);
1.249 + break;
1.250 +
1.251 + case EStringVal:
1.252 + err = TheRepository->Get(
1.253 + (aTestType == ECreateTest ? KNewStrKey : KStrKey), strVal);
1.254 + aResult = (strVal == KNewStrVal);
1.255 + break;
1.256 +
1.257 + case EMetaVal:
1.258 + // no meta testing on new setting so fall through
1.259 +
1.260 + default:
1.261 + err = KErrNotFound;
1.262 + break;
1.263 + }
1.264 + return err;
1.265 + }
1.266 +
1.267 +
1.268 +/**
1.269 + * Common code for calling Set()
1.270 + *
1.271 + * @param aValType enum indicating which data type to test
1.272 + * (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will return KErrArgument).
1.273 + * @return err code from Set()
1.274 + */
1.275 +TInt SetNewVal(TValType aValType)
1.276 + {
1.277 + TInt err(KErrNone);
1.278 +
1.279 + switch (aValType)
1.280 + {
1.281 + case EIntVal:
1.282 + err = TheRepository->Set(KIntKey, KNewIntVal);
1.283 + break;
1.284 +
1.285 + case ERealVal:
1.286 + err = TheRepository->Set(KRealKey, KNewRealVal);
1.287 + break;
1.288 +
1.289 + case EBinaryVal:
1.290 + err = TheRepository->Set(KBinKey, KNewBinVal);
1.291 + break;
1.292 +
1.293 + case EStringVal:
1.294 + err = TheRepository->Set(KStrKey, KNewStrVal);
1.295 + break;
1.296 +
1.297 + case EMetaVal:
1.298 + // no meta testing on new setting so fall through
1.299 +
1.300 + default:
1.301 + err = KErrArgument;
1.302 + break;
1.303 + }
1.304 + return err;
1.305 + }
1.306 +
1.307 +
1.308 +/**
1.309 + * Common code for calling Create()
1.310 + *
1.311 + * @param aValType enum indicating which data type to test
1.312 + * (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will return KErrArgument).
1.313 + * @return err code from Create()
1.314 + */
1.315 +TInt CreateNewSetting(TValType aValType)
1.316 + {
1.317 + TInt err(KErrNone);
1.318 +
1.319 + switch (aValType)
1.320 + {
1.321 + case EIntVal:
1.322 + err = TheRepository->Create(KNewIntKey, KNewIntVal);
1.323 + break;
1.324 +
1.325 + case ERealVal:
1.326 + err = TheRepository->Create(KNewRealKey, KNewRealVal);
1.327 + break;
1.328 +
1.329 + case EBinaryVal:
1.330 + err = TheRepository->Create(KNewBinKey, KNewBinVal);
1.331 + break;
1.332 +
1.333 + case EStringVal:
1.334 + err = TheRepository->Create(KNewStrKey, KNewStrVal);
1.335 + break;
1.336 +
1.337 + case EMetaVal:
1.338 + // no meta testing on new setting so fall through
1.339 +
1.340 + default:
1.341 + err = KErrArgument;
1.342 + break;
1.343 + }
1.344 + return err;
1.345 + }
1.346 +
1.347 +
1.348 +/**
1.349 + * Common code for calling Reset()
1.350 + *
1.351 + * @param aValType enum indicating which data type to test
1.352 + * (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will return KErrArgument).
1.353 + * @return err code from Reset()
1.354 + */
1.355 +TInt ResetSetting(TValType aValType)
1.356 + {
1.357 + TInt err(KErrNone);
1.358 +
1.359 + switch (aValType)
1.360 + {
1.361 + case EIntVal:
1.362 + err = TheRepository->Reset(KIntKey);
1.363 + break;
1.364 +
1.365 + case ERealVal:
1.366 + err = TheRepository->Reset(KRealKey);
1.367 + break;
1.368 +
1.369 + case EBinaryVal:
1.370 + err = TheRepository->Reset(KBinKey);
1.371 + break;
1.372 +
1.373 + case EStringVal:
1.374 + err = TheRepository->Reset(KStrKey);
1.375 + break;
1.376 +
1.377 + case EMetaVal:
1.378 + // no meta testing on new setting so fall through
1.379 +
1.380 + default:
1.381 + err = KErrArgument;
1.382 + break;
1.383 + }
1.384 + return err;
1.385 + }
1.386 +
1.387 +
1.388 +/**
1.389 + * Common code for calling FindL()
1.390 + *
1.391 + * @param aStart Out parameter for start timer value
1.392 + * @param aEnd Out parameter for end timer value
1.393 + * @param aFound Out parameter for number of settings found
1.394 + * @return err code from FindL()
1.395 + */
1.396 +TInt FindRangeL(TInt& aStart, TInt& aEnd, TInt& aFound)
1.397 + {
1.398 + RArray<TUint32> keys;
1.399 + CleanupClosePushL(keys);
1.400 +
1.401 + aStart = User::FastCounter();
1.402 + TInt err = TheRepository->FindL(KFindPartialKey, KFindMask, keys);
1.403 + aEnd = User::FastCounter();
1.404 +
1.405 + aFound = keys.Count();
1.406 +
1.407 + CleanupStack::PopAndDestroy(&keys);
1.408 +
1.409 + return err;
1.410 + }
1.411 +
1.412 +
1.413 +/**
1.414 + * Common code for performing all the Get() tests
1.415 + *
1.416 + * @param aValType enum indicating which data type to test
1.417 + * (EIntVal, ERealVal, EBinaryVal, EStringVal or EMetaVal -- any other value will fail with KErrArgument).
1.418 + * @param aUseTransaction bool instructing whether to use a read-mode transaction or not
1.419 + */
1.420 +void DoGetTest(TValType aValType, TBool aUseTransaction = EFalse)
1.421 + {
1.422 + TInt err(KErrNone);
1.423 + TInt result(EFalse);
1.424 + TUint32 keyInfo(0);
1.425 +
1.426 + TUint32 start = User::FastCounter();
1.427 +
1.428 + // start transaction, if required
1.429 + err = aUseTransaction ? TheRepository->StartTransaction(CRepository::EReadTransaction) : err;
1.430 + TEST2(err, KErrNone);
1.431 +
1.432 + err = GetOldVal(aValType, result);
1.433 + TEST2(err, KErrNone);
1.434 +
1.435 + // end transaction, if required
1.436 + err = aUseTransaction ? TheRepository->CommitTransaction(keyInfo) : err;
1.437 + TEST2(err, KErrNone);
1.438 +
1.439 + TUint32 end = User::FastCounter();
1.440 +
1.441 + TEST(result);
1.442 +
1.443 + PrintStats(start, end);
1.444 + }
1.445 +
1.446 +
1.447 +/**
1.448 + * Common code for performing the Set() and Reset() tests for all datatypes
1.449 + *
1.450 + * @param aValType enum indicating which data type to test
1.451 + * (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will fail with KErrArgument).
1.452 + * @param aTestType enum defining whether Set() or Reset() should be timed
1.453 + */
1.454 +void DoSetResetTest(TValType aValType, TTestType aTestType)
1.455 + {
1.456 + TInt err(KErrNone);
1.457 + TInt result(EFalse);
1.458 +
1.459 + // Check we get the old expected value
1.460 + err = GetOldVal(aValType, result);
1.461 + TEST2(err, KErrNone);
1.462 + TEST(result);
1.463 +
1.464 + TUint32 start(0);
1.465 + TUint32 end(0);
1.466 +
1.467 + // Set the new value
1.468 + start = aTestType == ESetTest ? User::FastCounter() : start;
1.469 + err = SetNewVal(aValType);
1.470 + end = aTestType == ESetTest ? User::FastCounter() : end;
1.471 + TEST2(err, KErrNone);
1.472 +
1.473 + // Test we get the new value to check it's worked
1.474 + err = GetNewVal(aValType, ESetTest, result);
1.475 + TEST2(err, KErrNone);
1.476 + TEST(result);
1.477 +
1.478 + // Restore the old value
1.479 + start = aTestType == EResetTest ? User::FastCounter() : start;
1.480 + err = ResetSetting(aValType);
1.481 + end = aTestType == EResetTest ? User::FastCounter() : end;
1.482 + TEST2(err, KErrNone);
1.483 +
1.484 + // Check reset's worked
1.485 + err = GetOldVal(aValType, result);
1.486 + TEST2(err, KErrNone);
1.487 + TEST(result);
1.488 +
1.489 + PrintStats(start, end);
1.490 + }
1.491 +
1.492 +
1.493 +/**
1.494 + * Common code for performing all the Create() tests
1.495 + *
1.496 + * @param aValType enum indicating which data type to test
1.497 + * (EIntVal, ERealVal, EBinaryVal, EStringVal, EMetaVal -- any other value will fail with KErrArgument).
1.498 + */
1.499 +void DoCreateTest(TValType aValType)
1.500 + {
1.501 + TInt err(KErrNone);
1.502 + TInt result(EFalse);
1.503 +
1.504 + TUint32 start(0);
1.505 + TUint32 end(0);
1.506 +
1.507 + // Create the new setting
1.508 + start = User::FastCounter();
1.509 + err = CreateNewSetting(aValType);
1.510 + end = User::FastCounter();
1.511 + TEST2(err, KErrNone);
1.512 +
1.513 + // Test we get the right value from the new setting to check it's worked
1.514 + err = GetNewVal(aValType, ECreateTest, result);
1.515 + TEST2(err, KErrNone);
1.516 + TEST(result);
1.517 +
1.518 + PrintStats(start, end);
1.519 + }
1.520 +
1.521 +
1.522 +/**
1.523 + * Common code for performing all the FindEqL() and FindNeqL() tests
1.524 + *
1.525 + * @param aValType enum indicating which data type to test
1.526 + * (EIntVal, ERealVal, EBinaryVal, EStringVal, EMetaVal -- any other value will fail with KErrArgument).
1.527 + * @param aTestType enum defining whether FindEqL() or FindNeqL() should be timed
1.528 + * (EFindEqTest or EFindNeqTest -- anything else will leave with KErrArgument).
1.529 + */
1.530 +void DoFindEqNeqTestL(TValType aValType, TTestType aTestType)
1.531 + {
1.532 + const TUint32 KPartialKey(0x8D800000);
1.533 + const TUint32 KMask(0xFFF00000);
1.534 + const TInt KFindNum(1);
1.535 + const TInt KNotFindNum(15);
1.536 +
1.537 + const TInt KIntFindVal(9999);
1.538 + const TReal KRealFindVal(999.9);
1.539 + _LIT8(KBinFindVal, "\xab\xcd\x99\x99");
1.540 + _LIT(KStrFindVal, "abcd9999");
1.541 +
1.542 + RArray<TUint32> results;
1.543 + CleanupClosePushL(results);
1.544 +
1.545 + TInt expectedCount(0);
1.546 + switch(aTestType)
1.547 + {
1.548 + case EFindEqTest:
1.549 + expectedCount = KFindNum;
1.550 + break;
1.551 +
1.552 + case EFindNeqTest:
1.553 + expectedCount = KNotFindNum;
1.554 + break;
1.555 +
1.556 + default:
1.557 + // wrong test type passed in
1.558 + User::Leave(KErrArgument);
1.559 + }
1.560 +
1.561 + TInt err(KErrNone);
1.562 +
1.563 + TUint32 start = User::FastCounter();
1.564 + switch (aValType)
1.565 + {
1.566 + case EIntVal:
1.567 + err = (aTestType == EFindEqTest) ?
1.568 + TheRepository->FindEqL(KPartialKey, KMask, KIntFindVal, results) :
1.569 + TheRepository->FindNeqL(KPartialKey, KMask, KIntFindVal, results);
1.570 + break;
1.571 +
1.572 + case ERealVal:
1.573 + err = (aTestType == EFindEqTest) ?
1.574 + TheRepository->FindEqL(KPartialKey, KMask, KRealFindVal, results) :
1.575 + TheRepository->FindNeqL(KPartialKey, KMask, KRealFindVal, results);
1.576 + break;
1.577 +
1.578 + case EBinaryVal:
1.579 + err = (aTestType == EFindEqTest) ?
1.580 + TheRepository->FindEqL(KPartialKey, KMask, KBinFindVal, results) :
1.581 + TheRepository->FindNeqL(KPartialKey, KMask, KBinFindVal, results);
1.582 + break;
1.583 +
1.584 + case EStringVal:
1.585 + err = (aTestType == EFindEqTest) ?
1.586 + TheRepository->FindEqL(KPartialKey, KMask, KStrFindVal, results) :
1.587 + TheRepository->FindNeqL(KPartialKey, KMask, KStrFindVal, results);
1.588 + break;
1.589 +
1.590 + case EMetaVal:
1.591 + // no meta testing on new setting so fall through
1.592 +
1.593 + default:
1.594 + err = KErrArgument;
1.595 + break;
1.596 + }
1.597 + TUint32 end = User::FastCounter();
1.598 +
1.599 + // Test there was no error and that we found the expected number
1.600 + TEST2(err, KErrNone);
1.601 + TEST(results.Count() == expectedCount);
1.602 +
1.603 + CleanupStack::PopAndDestroy(&results);
1.604 +
1.605 + PrintStats(start, end);
1.606 + }
1.607 +
1.608 +///////////////////////////////////////////////////////////////////////////////////////
1.609 +///////////////////////////////////////////////////////////////////////////////////////
1.610 +
1.611 +// TEST CASES
1.612 +
1.613 +/**
1.614 +@SYMTestCaseID PDS-CENTRALREPOSITORY-UT-4047
1.615 +@SYMTestCaseDesc CRepository::Get(TUint32 aKey, TInt& aValue) - performance test
1.616 + The test measures the time needed for retrieving of a single integer setting.
1.617 +@SYMTestPriority High
1.618 +@SYMTestActions CRepository::Get(TUint32 aKey, TInt& aValue) - performance test
1.619 +@SYMTestExpectedResults Test must not fail
1.620 +@SYMDEF DEF128986
1.621 +*/
1.622 +void GetIntTest()
1.623 + {
1.624 + DoGetTest(EIntVal);
1.625 + }
1.626 +
1.627 +
1.628 +/**
1.629 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4087
1.630 +@SYMTestCaseDesc CRepository::Get(TUint32 aKey, TReal& aValue) - performance test
1.631 + The test measures the time needed for retrieving of a single real setting,
1.632 + witht the Get() wrapped in a read-mode transaction.
1.633 +@SYMTestPriority High
1.634 +@SYMTestActions CRepository::Get(TUint32 aKey, TReal& aValue)
1.635 +@SYMTestExpectedResults Test must not fail
1.636 +@SYMPREQ PREQ2505
1.637 +@SYMREQ REQ13142
1.638 +*/
1.639 +void GetRealTest()
1.640 + {
1.641 + DoGetTest(ERealVal, ETrue);
1.642 + }
1.643 +
1.644 +
1.645 +/**
1.646 +@SYMTestCaseID PDS-CENTRALREPOSITORY-UT-4048
1.647 +@SYMTestCaseDesc CRepository::Get(TUint32 aKey, TDes8& aValue) - performance test
1.648 + The test measures the time needed for retrieving of a single 8-bit string setting.
1.649 +@SYMTestPriority High
1.650 +@SYMTestActions CRepository::Get(TUint32 aKey, TDes8& aValue) - performance test
1.651 +@SYMTestExpectedResults Test must not fail
1.652 +@SYMDEF DEF128986
1.653 +*/
1.654 +void GetBinaryTest()
1.655 + {
1.656 + DoGetTest(EBinaryVal);
1.657 + }
1.658 +
1.659 +
1.660 +/**
1.661 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4088
1.662 +@SYMTestCaseDesc CRepository::Get(TUint32 aKey, TDes8& aValue) - performance test
1.663 + The test measures the time needed for retrieving of a single 8-bit string setting,
1.664 + with the Get() wrapped in a read-mode transaction.
1.665 +@SYMTestPriority High
1.666 +@SYMTestActions CRepository::Get(TUint32 aKey, TDes8& aValue)
1.667 + CRepository::StartTransaction(TTransactionMode aMode)
1.668 + CRepository::CommitTransaction(TUint32 &aKeyInfo)
1.669 +@SYMTestExpectedResults Test must not fail
1.670 +@SYMPREQ PREQ2505
1.671 +@SYMREQ REQ13142
1.672 +*/
1.673 +void GetBinaryInTransactionTest()
1.674 + {
1.675 + DoGetTest(EBinaryVal, ETrue);
1.676 + }
1.677 +
1.678 +
1.679 +/**
1.680 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4089
1.681 +@SYMTestCaseDesc CRepository::Get(TUint32 aKey, TDesC16& aValue) - performance test
1.682 + The test measures the time needed for retrieving of a single 16-bit string setting.
1.683 +@SYMTestPriority High
1.684 +@SYMTestActions CRepository::Get(TUint32 aKey, TDesC16& aValue)
1.685 +@SYMTestExpectedResults Test must not fail
1.686 +@SYMPREQ PREQ2505
1.687 +@SYMREQ REQ13142
1.688 +*/
1.689 +void GetStringTest()
1.690 + {
1.691 + DoGetTest(EStringVal, ETrue);
1.692 + }
1.693 +
1.694 +
1.695 +/**
1.696 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4090
1.697 +@SYMTestCaseDesc CRepository::GetMeta(TUint32 aKey, TUint32& aMeta) - performance test
1.698 + The test measures the time needed for retrieving metadata for a single setting.
1.699 +@SYMTestPriority High
1.700 +@SYMTestActions CRepository::GetMeta(TUint32 aKey, TUint32& aMeta)
1.701 +@SYMTestExpectedResults Test must not fail
1.702 +@SYMPREQ PREQ2505
1.703 +@SYMREQ REQ13142
1.704 +*/
1.705 +void GetMetaTest()
1.706 + {
1.707 + DoGetTest(EMetaVal, ETrue);
1.708 + }
1.709 +
1.710 +
1.711 +/**
1.712 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4091
1.713 +@SYMTestCaseDesc CRepository::Set(TUint32 aKey, TInt aValue) - performance test
1.714 + The test measures the time needed for setting a single integer setting.
1.715 +@SYMTestPriority High
1.716 +@SYMTestActions CRepository::Set(TUint32 aKey, TInt aValue)
1.717 +@SYMTestExpectedResults Test must not fail
1.718 +@SYMPREQ PREQ2505
1.719 +@SYMREQ REQ13142
1.720 +*/
1.721 +void SetIntTest()
1.722 + {
1.723 + DoSetResetTest(EIntVal, ESetTest);
1.724 + }
1.725 +
1.726 +
1.727 +/**
1.728 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4092
1.729 +@SYMTestCaseDesc CRepository::Set(TUint32 aKey, TReal aValue) - performance test
1.730 + The test measures the time needed for setting a single real setting.
1.731 +@SYMTestPriority High
1.732 +@SYMTestActions CRepository::Set(TUint32 aKey, TReal aValue)
1.733 +@SYMTestExpectedResults Test must not fail
1.734 +@SYMPREQ PREQ2505
1.735 +@SYMREQ REQ13142
1.736 +*/
1.737 +void SetRealTest()
1.738 + {
1.739 + DoSetResetTest(ERealVal, ESetTest);
1.740 + }
1.741 +
1.742 +
1.743 +/**
1.744 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4093
1.745 +@SYMTestCaseDesc CRepository::Set(TUint32 aKey, TDes8& aValue) - performance test
1.746 + The test measures the time needed for setting a single 8-bit string setting.
1.747 +@SYMTestPriority High
1.748 +@SYMTestActions CRepository::Set(TUint32 aKey, TDes8& aValue)
1.749 +@SYMTestExpectedResults Test must not fail
1.750 +@SYMPREQ PREQ2505
1.751 +@SYMREQ REQ13142
1.752 +*/
1.753 +void SetBinaryTest()
1.754 + {
1.755 + DoSetResetTest(EBinaryVal, ESetTest);
1.756 + }
1.757 +
1.758 +
1.759 +/**
1.760 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4094
1.761 +@SYMTestCaseDesc CRepository::Set(TUint32 aKey, TDesC16& aValue) - performance test
1.762 + The test measures the time needed for setting a single 16-bit string setting.
1.763 +@SYMTestPriority High
1.764 +@SYMTestActions CRepository::Set(TUint32 aKey, TDesC16& aValue)
1.765 +@SYMTestExpectedResults Test must not fail
1.766 +@SYMPREQ PREQ2505
1.767 +@SYMREQ REQ13142
1.768 +*/
1.769 +void SetStringTest()
1.770 + {
1.771 + DoSetResetTest(EStringVal, ESetTest);
1.772 + }
1.773 +
1.774 +
1.775 +/**
1.776 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4095
1.777 +@SYMTestCaseDesc CRepository::Create(TUint32 aKey, TInt aValue) - performance test
1.778 + The test measures the time needed for creating a new single integer setting.
1.779 +@SYMTestPriority High
1.780 +@SYMTestActions CRepository::Create(TUint32 aKey, TInt aValue)
1.781 +@SYMTestExpectedResults Test must not fail
1.782 +@SYMPREQ PREQ2505
1.783 +@SYMREQ REQ13142
1.784 +*/
1.785 +void CreateIntTest()
1.786 + {
1.787 + DoCreateTest(EIntVal);
1.788 + }
1.789 +
1.790 +
1.791 +/**
1.792 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4096
1.793 +@SYMTestCaseDesc CRepository::Create(TUint32 aKey, TReal aValue) - performance test
1.794 + The test measures the time needed for creating a new single real setting.
1.795 +@SYMTestPriority High
1.796 +@SYMTestActions CRepository::Create(TUint32 aKey, TReal aValue)
1.797 +@SYMTestExpectedResults Test must not fail
1.798 +@SYMPREQ PREQ2505
1.799 +@SYMREQ REQ13142
1.800 +*/
1.801 +void CreateRealTest()
1.802 + {
1.803 + DoCreateTest(ERealVal);
1.804 + }
1.805 +
1.806 +
1.807 +/**
1.808 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4097
1.809 +@SYMTestCaseDesc CRepository::Create(TUint32 aKey, TDesC8& aValue) - performance test
1.810 + The test measures the time needed for creating a new single 8-bit string setting.
1.811 +@SYMTestPriority High
1.812 +@SYMTestActions CRepository::Create(TUint32 aKey, TDesC8& aValue)
1.813 +@SYMTestExpectedResults Test must not fail
1.814 +@SYMPREQ PREQ2505
1.815 +@SYMREQ REQ13142
1.816 +*/
1.817 +void CreateBinaryTest()
1.818 + {
1.819 + DoCreateTest(EBinaryVal);
1.820 + }
1.821 +
1.822 +
1.823 +/**
1.824 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4098
1.825 +@SYMTestCaseDesc CRepository::Create(TUint32 aKey, TDesC16& aValue) - performance test
1.826 + The test measures the time needed for creating a new single 16-bit string setting.
1.827 +@SYMTestPriority High
1.828 +@SYMTestActions CRepository::Create(TUint32 aKey, TDesC16& aValue)
1.829 +@SYMTestExpectedResults Test must not fail
1.830 +@SYMPREQ PREQ2505
1.831 +@SYMREQ REQ13142
1.832 +*/
1.833 +void CreateStringTest()
1.834 + {
1.835 + DoCreateTest(EStringVal);
1.836 + }
1.837 +
1.838 +
1.839 +/**
1.840 +@SYMTestCaseID PDS-CENTRALREPOSITORY-UT-4049
1.841 +@SYMTestCaseDesc CRepository::FindL(TUint32 aPartialKey, TUint32 aMask, RArray<TUint32>& aFoundKeys) - performance test
1.842 + The test measures the time needed for retrieving of an array of keys matching the function arguments.
1.843 +@SYMTestPriority High
1.844 +@SYMTestActions CRepository::FindL(TUint32 aPartialKey, TUint32 aMask, RArray<TUint32>& aFoundKeys)
1.845 +@SYMTestExpectedResults Test must not fail
1.846 +@SYMDEF DEF128986
1.847 +*/
1.848 +void FindTestL()
1.849 + {
1.850 + TInt start(0);
1.851 + TInt end(0);
1.852 + TInt found(0);
1.853 +
1.854 + TInt err = FindRangeL(start, end, found);
1.855 +
1.856 + TEST2(err, KErrNone);
1.857 + TEST2(found, KFindKeyCount);
1.858 +
1.859 + PrintStats(start, end);
1.860 + }
1.861 +
1.862 +
1.863 +/**
1.864 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4099
1.865 +@SYMTestCaseDesc CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TInt aValue, RArray< TUint32 > &aFoundKeys) - performance test
1.866 + The test measures the time to find an int setting in an "equals" search on a range.
1.867 +@SYMTestPriority High
1.868 +@SYMTestActions CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TInt aValue, RArray< TUint32 > &aFoundKeys)
1.869 +@SYMTestExpectedResults Test must not fail
1.870 +@SYMPREQ PREQ2505
1.871 +@SYMREQ REQ13142
1.872 +*/
1.873 +void FindEqIntTestL()
1.874 + {
1.875 + DoFindEqNeqTestL(EIntVal, EFindEqTest);
1.876 + }
1.877 +
1.878 +
1.879 +/**
1.880 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4100
1.881 +@SYMTestCaseDesc CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TReal aValue, RArray< TUint32 > &aFoundKeys) - performance test
1.882 + The test measures the time to find a real setting in an "equals" search on a range.
1.883 +@SYMTestPriority High
1.884 +@SYMTestActions CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TReal aValue, RArray< TUint32 > &aFoundKeys)
1.885 +@SYMTestExpectedResults Test must not fail
1.886 +@SYMPREQ PREQ2505
1.887 +@SYMREQ REQ13142
1.888 +*/
1.889 +void FindEqRealTestL()
1.890 + {
1.891 + DoFindEqNeqTestL(ERealVal, EFindEqTest);
1.892 + }
1.893 +
1.894 +
1.895 +/**
1.896 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4101
1.897 +@SYMTestCaseDesc CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TDesC8& aValue, RArray< TUint32 > &aFoundKeys) - performance test
1.898 + The test measures the time to find an 8-bit string setting in an "equals" search on a range.
1.899 +@SYMTestPriority High
1.900 +@SYMTestActions CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TDesC8& aValue, RArray< TUint32 > &aFoundKeys)
1.901 +@SYMTestExpectedResults Test must not fail
1.902 +@SYMPREQ PREQ2505
1.903 +@SYMREQ REQ13142
1.904 +*/
1.905 +void FindEqBinaryTestL()
1.906 + {
1.907 + DoFindEqNeqTestL(EBinaryVal, EFindEqTest);
1.908 + }
1.909 +
1.910 +
1.911 +/**
1.912 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4102
1.913 +@SYMTestCaseDesc CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TDesC16& aValue, RArray< TUint32 > &aFoundKeys) - performance test
1.914 + The test measures the time to find an 16-bit string setting in an "equals" search on a range.
1.915 +@SYMTestPriority High
1.916 +@SYMTestActions CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TDesC16& aValue, RArray< TUint32 > &aFoundKeys)
1.917 +@SYMTestExpectedResults Test must not fail
1.918 +@SYMPREQ PREQ2505
1.919 +@SYMREQ REQ13142
1.920 +*/
1.921 +void FindEqStringTestL()
1.922 + {
1.923 + DoFindEqNeqTestL(EStringVal, EFindEqTest);
1.924 + }
1.925 +
1.926 +
1.927 +/**
1.928 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4103
1.929 +@SYMTestCaseDesc CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TInt aValue, RArray< TUint32 > &aFoundKeys) - performance test
1.930 + The test measures the time to find an int setting in an "not equals" search on a range.
1.931 +@SYMTestPriority High
1.932 +@SYMTestActions CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TInt aValue, RArray< TUint32 > &aFoundKeys)
1.933 +@SYMTestExpectedResults Test must not fail
1.934 +@SYMPREQ PREQ2505
1.935 +@SYMREQ REQ13142
1.936 +*/
1.937 +void FindNeqIntTestL()
1.938 + {
1.939 + DoFindEqNeqTestL(EIntVal, EFindNeqTest);
1.940 + }
1.941 +
1.942 +
1.943 +/**
1.944 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4104
1.945 +@SYMTestCaseDesc CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TReal aValue, RArray< TUint32 > &aFoundKeys) - performance test
1.946 + The test measures the time to find a real setting in an "not equals" search on a range.
1.947 +@SYMTestPriority High
1.948 +@SYMTestActions CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TReal aValue, RArray< TUint32 > &aFoundKeys)
1.949 +@SYMTestExpectedResults Test must not fail
1.950 +@SYMPREQ PREQ2505
1.951 +@SYMREQ REQ13142
1.952 +*/
1.953 +void FindNeqRealTestL()
1.954 + {
1.955 + DoFindEqNeqTestL(ERealVal, EFindNeqTest);
1.956 + }
1.957 +
1.958 +
1.959 +/**
1.960 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4105
1.961 +@SYMTestCaseDesc CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TDesC8& aValue, RArray< TUint32 > &aFoundKeys) - performance test
1.962 + The test measures the time to find an 8-bit string setting in an "not equals" search on a range.
1.963 +@SYMTestPriority High
1.964 +@SYMTestActions CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TDesC8& aValue, RArray< TUint32 > &aFoundKeys)
1.965 +@SYMTestExpectedResults Test must not fail
1.966 +@SYMPREQ PREQ2505
1.967 +@SYMREQ REQ13142
1.968 +*/
1.969 +void FindNeqBinaryTestL()
1.970 + {
1.971 + DoFindEqNeqTestL(EBinaryVal, EFindNeqTest);
1.972 + }
1.973 +
1.974 +
1.975 +/**
1.976 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4106
1.977 +@SYMTestCaseDesc CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TDesC16& aValue, RArray< TUint32 > &aFoundKeys) - performance test
1.978 + The test measures the time to find an 16-bit string setting in an "not equals" search on a range.
1.979 +@SYMTestPriority High
1.980 +@SYMTestActions CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TDesC16& aValue, RArray< TUint32 > &aFoundKeys)
1.981 +@SYMTestExpectedResults Test must not fail
1.982 +@SYMPREQ PREQ2505
1.983 +@SYMREQ REQ13142
1.984 +*/
1.985 +void FindNeqStringTestL()
1.986 + {
1.987 + DoFindEqNeqTestL(EStringVal, EFindNeqTest);
1.988 + }
1.989 +
1.990 +
1.991 +/**
1.992 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4107
1.993 +@SYMTestCaseDesc Performance test that measures the time taken to retrieve data to rebuild a table of ints with 22 rows
1.994 + and 8 columns, using successive calls of Find() with subsequent calls to Get for each key retrieved.
1.995 +@SYMTestPriority High
1.996 +@SYMTestActions CRepository::FindL(TUint32 aPartialKey, TUint32 aMask, RArray<TUint32>& aFoundKeys)
1.997 + CRepository::Get(TUint32 aPartialKey, TUint32 aMask, RArray<TUint32>& aFoundKeys)
1.998 +@SYMTestExpectedResults Test must not fail
1.999 +@SYMPREQ PREQ2505
1.1000 +@SYMREQ REQ13142
1.1001 +*/
1.1002 +void RetrieveTableTestL()
1.1003 + {
1.1004 + TUint32 partialKeyData[] = {
1.1005 + 0x03950000, 0x03980000, 0x039A0000, 0x039E0000, 0x03A80000, 0x03A90000,
1.1006 + 0x03AA0000, 0x03AB0000, 0x03B50000, 0x03B60000, 0x03B70000, 0x03B80000,
1.1007 + 0x03B90000, 0x03BA0000, 0x03BB0000, 0x03BC0000, 0x03BD0000, 0x03BE0000,
1.1008 + 0x03BF0000, 0x03C00000, 0x03C10000, 0x03C20000
1.1009 + };
1.1010 + const TInt KNumRows(22); // same as number of partialKeys in array above
1.1011 + const TInt KNumCols(8); // expected number of columns per row
1.1012 + const TUint32 KMask(0xFFFF0000); // match top 2 bytes
1.1013 +
1.1014 + RArray<TUint32> rowKeys(KNumCols); // set granularity to num cols
1.1015 + CleanupClosePushL(rowKeys);
1.1016 +
1.1017 + TUint32 start = User::FastCounter();
1.1018 +
1.1019 + for (TInt i(0); i < KNumRows; ++i)
1.1020 + {
1.1021 + // fetch all keys representing columns/cells in the row
1.1022 + // matching the key range defined by the partial key
1.1023 + TInt findErr = TheRepository->FindL(partialKeyData[i], KMask, rowKeys);
1.1024 + TEST2(findErr, KErrNone);
1.1025 +
1.1026 + const TInt KColCount = rowKeys.Count();
1.1027 + TEST(KColCount == KNumCols);
1.1028 +
1.1029 + // retrieve data for each column/cell represented
1.1030 + // by a key from the row key range
1.1031 + TInt value(KErrNotFound);
1.1032 + for (TInt j(0); j < KColCount; ++j)
1.1033 + {
1.1034 + TInt getErr = TheRepository->Get(rowKeys[j], value);
1.1035 + TEST2(getErr, KErrNone);
1.1036 +
1.1037 + // data for these cells are 0 or 1
1.1038 + TEST(value == 0 || value == 1);
1.1039 + }
1.1040 +
1.1041 + // clear our keys array for next row
1.1042 + rowKeys.Reset();
1.1043 + }
1.1044 +
1.1045 + TUint32 end = User::FastCounter();
1.1046 + PrintStats(start, end);
1.1047 +
1.1048 + CleanupStack::PopAndDestroy(&rowKeys);
1.1049 + }
1.1050 +
1.1051 +
1.1052 +/**
1.1053 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4108
1.1054 +@SYMTestCaseDesc CRepository::Move(TUint32 aSourcePartialKey, TUint32 aTargetPartialKey, TUint32 aMask, TUint32 &aErrorKey) - performance test
1.1055 + The test measures the time needed for moving a single integer setting.
1.1056 +@SYMTestPriority High
1.1057 +@SYMTestActions CRepository::Move(TUint32 aSourcePartialKey, TUint32 aTargetPartialKey, TUint32 aMask, TUint32 &aErrorKey)
1.1058 +@SYMTestExpectedResults Test must not fail
1.1059 +@SYMPREQ PREQ2505
1.1060 +@SYMREQ REQ13142
1.1061 +*/
1.1062 +void MoveTest()
1.1063 + {
1.1064 + TUint32 errorKey(0);
1.1065 +
1.1066 + // Move a setting to a new key
1.1067 + TUint32 start = User::FastCounter();
1.1068 + TInt err = TheRepository->Move(KNewIntKey, KNewIntKey2, 0xFFFFFFFF, errorKey);
1.1069 + TUint32 end = User::FastCounter();
1.1070 + TEST2(err, KErrNone);
1.1071 +
1.1072 + // Test we get the right value from the new location
1.1073 + TInt val(0);
1.1074 + err = TheRepository->Get(KNewIntKey2, val);
1.1075 + TEST2(err, KErrNone);
1.1076 + TEST2(val, KNewIntVal);
1.1077 +
1.1078 + // Test we get the KErrNotFound from the old location
1.1079 + err = TheRepository->Get(KNewIntKey, val);
1.1080 + TEST2(err, KErrNotFound);
1.1081 +
1.1082 + PrintStats(start, end);
1.1083 + }
1.1084 +
1.1085 +
1.1086 +/**
1.1087 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4109
1.1088 +@SYMTestCaseDesc CRepository::Delete(TUint32 aKey) - performance test
1.1089 + The test measures the time needed for deleting a single setting.
1.1090 +@SYMTestPriority High
1.1091 +@SYMTestActions CRepository::Delete(TUint32 aKey)
1.1092 +@SYMTestExpectedResults Test must not fail
1.1093 +@SYMPREQ PREQ2505
1.1094 +@SYMREQ REQ13142
1.1095 +*/
1.1096 +void DeleteTest()
1.1097 + {
1.1098 + // Test the setting is there and we get the right value
1.1099 + TInt val(0);
1.1100 + TInt err = TheRepository->Get(KNewIntKey2, val);
1.1101 + TEST2(err, KErrNone);
1.1102 + TEST2(val, KNewIntVal);
1.1103 +
1.1104 + // Delete the setting
1.1105 + TUint32 start = User::FastCounter();
1.1106 + err = TheRepository->Delete(KNewIntKey2);
1.1107 + TUint32 end = User::FastCounter();
1.1108 + TEST2(err, KErrNone);
1.1109 +
1.1110 + // Test we get the KErrNotFound from the key now
1.1111 + err = TheRepository->Get(KNewIntKey2, val);
1.1112 + TEST2(err, KErrNotFound);
1.1113 +
1.1114 + PrintStats(start, end);
1.1115 + }
1.1116 +
1.1117 +/**
1.1118 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4110
1.1119 +@SYMTestCaseDesc CRepository::Delete(TUint32 aKey) - performance test
1.1120 + The test measures the time needed for deleting a single setting.
1.1121 +@SYMTestPriority High
1.1122 +@SYMTestActions CRepository::Delete(TUint32 aKey)
1.1123 +@SYMTestExpectedResults Test must not fail
1.1124 +@SYMPREQ PREQ2505
1.1125 +@SYMREQ REQ13142
1.1126 +*/
1.1127 +void DeleteRangeTestL()
1.1128 + {
1.1129 + TInt start(0);
1.1130 + TInt end(0);
1.1131 + TInt found(0);
1.1132 +
1.1133 + // Check we can find the settings in the range
1.1134 + // (ignore timing data here as we're not timing find)
1.1135 + TInt err = FindRangeL(start, end, found);
1.1136 + TEST2(err, KErrNone);
1.1137 + TEST2(found, KFindKeyCount);
1.1138 +
1.1139 + // Delete the setting
1.1140 + TUint32 errorKey(0);
1.1141 + start = User::FastCounter();
1.1142 + err = TheRepository->Delete(KFindPartialKey, KFindMask, errorKey);
1.1143 + end = User::FastCounter();
1.1144 + TEST2(err, KErrNone);
1.1145 +
1.1146 + // Check we *can't* find the settings in the range now they've been deleted
1.1147 + err = FindRangeL(start, end, found);
1.1148 + TEST2(err, KErrNotFound);
1.1149 +
1.1150 + PrintStats(start, end);
1.1151 + }
1.1152 +
1.1153 +
1.1154 +/**
1.1155 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4111
1.1156 +@SYMTestCaseDesc CRepository::Reset(TUint32 aKey) - performance test
1.1157 + The test measures the time needed for resetting a single integer setting.
1.1158 +@SYMTestPriority High
1.1159 +@SYMTestActions CRepository::Reset(TUint32 aKey)
1.1160 +@SYMTestExpectedResults Test must not fail
1.1161 +@SYMPREQ PREQ2505
1.1162 +@SYMREQ REQ13142
1.1163 +*/
1.1164 +void ResetTest()
1.1165 + {
1.1166 + DoSetResetTest(EIntVal, EResetTest);
1.1167 + }
1.1168 +
1.1169 +
1.1170 +/**
1.1171 +@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4112
1.1172 +@SYMTestCaseDesc CRepository::Reset() - performance test
1.1173 + The test measures the time needed for resetting the whole keyspace.
1.1174 +@SYMTestPriority High
1.1175 +@SYMTestActions CRepository::Reset()
1.1176 +@SYMTestExpectedResults Test must not fail
1.1177 +@SYMPREQ PREQ2505
1.1178 +@SYMREQ REQ13142
1.1179 +*/
1.1180 +void ResetAllTest()
1.1181 + {
1.1182 + // Check we can get the value of the newly created binary setting
1.1183 + TBool result;
1.1184 + TInt err = GetNewVal(EBinaryVal, ECreateTest, result);
1.1185 + TEST2(err, KErrNone);
1.1186 + TEST(result);
1.1187 +
1.1188 + // Reset the whole keyspace
1.1189 + TInt start = User::FastCounter();
1.1190 + TheRepository->Reset();
1.1191 + TInt end = User::FastCounter();
1.1192 + TEST2(err, KErrNone);
1.1193 +
1.1194 + // Check we *can't* get the value of the newly created binary setting
1.1195 + // since it shouldn't exist anymore after the Reset()
1.1196 + err = GetNewVal(EBinaryVal, ECreateTest, result);
1.1197 + TEST2(err, KErrNotFound);
1.1198 + PrintStats(start, end);
1.1199 + }
1.1200 +
1.1201 +///////////////////////////////////////////////////////////////////////////////////////
1.1202 +
1.1203 +// MAIN
1.1204 +
1.1205 +void DoTestsL()
1.1206 + {
1.1207 + TheTest.Start(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-UT-4047 Get Int test"));
1.1208 + GetIntTest();
1.1209 +
1.1210 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4087 Get Real test"));
1.1211 + GetRealTest();
1.1212 +
1.1213 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-UT-4048 Get Binary test"));
1.1214 + GetBinaryTest();
1.1215 +
1.1216 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4088 Get Binary in Transaction test"));
1.1217 + GetBinaryInTransactionTest();
1.1218 +
1.1219 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4089 Get String test"));
1.1220 + GetStringTest();
1.1221 +
1.1222 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4090 GetMeta test"));
1.1223 + GetMetaTest();
1.1224 +
1.1225 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4091 Set Int test"));
1.1226 + SetIntTest();
1.1227 +
1.1228 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4092 Set Real test"));
1.1229 + SetRealTest();
1.1230 +
1.1231 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4093 Set Binary test"));
1.1232 + SetBinaryTest();
1.1233 +
1.1234 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4094 Set String test"));
1.1235 + SetStringTest();
1.1236 +
1.1237 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4095 Create Int setting test"));
1.1238 + CreateIntTest();
1.1239 +
1.1240 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4096 Create Real setting test"));
1.1241 + CreateRealTest();
1.1242 +
1.1243 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4097 Create Binary setting test"));
1.1244 + CreateBinaryTest();
1.1245 +
1.1246 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4098 Create String setting test"));
1.1247 + CreateStringTest();
1.1248 +
1.1249 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-UT-4049 Find test"));
1.1250 + FindTestL();
1.1251 +
1.1252 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4099 FindEq Int test"));
1.1253 + FindEqIntTestL();
1.1254 +
1.1255 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4100 FindEq Real test"));
1.1256 + FindEqRealTestL();
1.1257 +
1.1258 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4101 FindEq Binary test"));
1.1259 + FindEqBinaryTestL();
1.1260 +
1.1261 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4102 FindEq String test"));
1.1262 + FindEqStringTestL();
1.1263 +
1.1264 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4103 FindNeq Int test"));
1.1265 + FindNeqIntTestL();
1.1266 +
1.1267 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4104 FindNeq Real test"));
1.1268 + FindNeqRealTestL();
1.1269 +
1.1270 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4105 FindNeq Binary test"));
1.1271 + FindNeqBinaryTestL();
1.1272 +
1.1273 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4106 FindNeq String test"));
1.1274 + FindNeqStringTestL();
1.1275 +
1.1276 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4107 Retrieve structured data table test"));
1.1277 + RetrieveTableTestL();
1.1278 +
1.1279 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4108 Move test"));
1.1280 + MoveTest();
1.1281 +
1.1282 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4109 Delete test"));
1.1283 + DeleteTest();
1.1284 +
1.1285 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4110 Delete test"));
1.1286 + DeleteRangeTestL();
1.1287 +
1.1288 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4111 Reset Single test"));
1.1289 + ResetTest();
1.1290 +
1.1291 + TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4112 Reset All test"));
1.1292 + ResetAllTest();
1.1293 + }
1.1294 +
1.1295 +
1.1296 +TInt E32Main()
1.1297 + {
1.1298 + TheTest.Title();
1.1299 +
1.1300 + CTrapCleanup* tc = CTrapCleanup::New();
1.1301 + TheTest(tc != NULL);
1.1302 +
1.1303 + __UHEAP_MARK;
1.1304 +
1.1305 + TRAPD(err, CreateTestEnvL());
1.1306 + TEST2(err, KErrNone);
1.1307 +
1.1308 + TRAP(err, DoTestsL());
1.1309 + DestroyTestEnv();
1.1310 + TEST2(err, KErrNone);
1.1311 +
1.1312 + __UHEAP_MARKEND;
1.1313 +
1.1314 + TheTest.End();
1.1315 + TheTest.Close();
1.1316 +
1.1317 + delete tc;
1.1318 +
1.1319 + User::Heap().Check();
1.1320 + return KErrNone;
1.1321 + }