sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: RTest TheTest(_L("t_cenrep_perf test")); sl@0: CRepository* TheRepository = NULL; sl@0: const TUid KTestCenRepUid = {0xCCCCCC03}; sl@0: _LIT(KFileName, "c:\\private\\10202be9\\persists\\cccccc03.cre"); sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: // Shared test data sl@0: sl@0: enum TValType {EIntVal, ERealVal, EBinaryVal, EStringVal, EMetaVal}; sl@0: enum TTestType {ESetTest, ECreateTest, EFindEqTest, EFindNeqTest, EResetTest}; sl@0: sl@0: // int sl@0: const TUint32 KIntKey = 42011136ul; sl@0: const TUint32 KNewIntKey = 2374040320ul; sl@0: const TUint32 KNewIntKey2 = 2374040576ul; sl@0: const TInt KOldIntVal = 10; sl@0: const TInt KNewIntVal = KOldIntVal + 1; sl@0: const TUint32 KIntMeta = 0; sl@0: sl@0: // real sl@0: const TUint32 KRealKey = 2374041088ul; sl@0: const TUint32 KNewRealKey = 2374041344ul; sl@0: const TReal KOldRealVal = 0.1; sl@0: const TReal KNewRealVal = KOldRealVal + 1.0; sl@0: sl@0: // binary sl@0: const TUint32 KBinKey = 42141952ul; sl@0: const TUint32 KNewBinKey = 2374040832ul; sl@0: _LIT8(KOldBinVal, "\x44\x00\x69\x00\x61\x00\x6c\x00\x4f\x00\x75\x00\x74\x00\x49\x00\x53\x00\x50\x00"); sl@0: _LIT8(KNewBinVal, "\x44\x00\x69\x00\x61\x00\x6c\x00\x4f\x00\x75\x00\x74\x00\x49\x00\x53\x00\x50\x01"); sl@0: sl@0: // string sl@0: const TUint32 KStrKey = 2374041600ul; sl@0: const TUint32 KNewStrKey = 2374041856ul; sl@0: _LIT(KOldStrVal, "hello"); sl@0: _LIT(KNewStrVal, "goodbye"); sl@0: sl@0: sl@0: // FindL range data sl@0: const TUint32 KFindPartialKey = 0x08440000ul; sl@0: const TUint32 KFindMask = 0x0FFF0000ul; sl@0: const TInt KFindKeyCount = 15; sl@0: sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: TInt DeleteCreFile() sl@0: { sl@0: RFs fs; sl@0: fs.Connect(); sl@0: TInt err = fs.Delete(KFileName); sl@0: fs.Close(); sl@0: sl@0: // it's fine if the file or path wasn't found as there's nothing to sl@0: // delete so return KErrNone sl@0: return (err == KErrNotFound || err == KErrPathNotFound) ? KErrNone : err; sl@0: } sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: void DestroyTestEnv() sl@0: { sl@0: delete TheRepository; sl@0: sl@0: // delete the CRE file to clear out any changes made during the test sl@0: DeleteCreFile(); sl@0: } sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: //Test macros and functions sl@0: void Check(TInt aValue, TInt aLine) sl@0: { sl@0: if(!aValue) sl@0: { sl@0: DestroyTestEnv(); sl@0: RDebug::Print(_L("*** Test failure. Boolean expression evaluates to false.\r\n")); sl@0: TheTest(EFalse, aLine); sl@0: } sl@0: } sl@0: void Check2(TInt aValue, TInt aExpected, TInt aLine) sl@0: { sl@0: if(aValue != aExpected) sl@0: { sl@0: DestroyTestEnv(); sl@0: RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); sl@0: TheTest(EFalse, aLine); sl@0: } sl@0: } sl@0: #define TEST(arg) ::Check((arg), __LINE__) sl@0: #define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__) sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: // leaves if it can't successfully delete the cre file if it exists sl@0: void CreateTestEnvL() sl@0: { sl@0: // delete the CRE file to clear out any changes leftover from previous test runs sl@0: User::LeaveIfError(DeleteCreFile()); sl@0: sl@0: TRAPD(err, TheRepository = CRepository::NewL(KTestCenRepUid)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: sl@0: sl@0: //Prints aTicks parameter (converted to us) sl@0: void PrintStats(TUint32 aStartTicks, TUint32 aEndTicks) sl@0: { sl@0: static TInt freq = 0; sl@0: if(freq == 0) sl@0: { sl@0: TEST2(HAL::Get(HAL::EFastCounterFrequency, freq), KErrNone); sl@0: } sl@0: TInt64 diffTicks = (TInt64)aEndTicks - (TInt64)aStartTicks; sl@0: if(diffTicks < 0) sl@0: { sl@0: diffTicks = KMaxTUint32 + diffTicks + 1; sl@0: } sl@0: const TInt KMicroSecIn1Sec = 1000000; sl@0: TInt32 us = (diffTicks * KMicroSecIn1Sec) / freq; sl@0: TheTest.Printf(_L("####Execution time: %d us\r\n"), us); sl@0: } sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: // Utility functions containing code common to multiple test cases sl@0: sl@0: /** sl@0: * Common code for calling Get() with old values sl@0: * sl@0: * @param aValType enum indicating which data type to test sl@0: * (EIntVal, ERealVal, EBinaryVal, EStringVal or EMetaVal-- any other value will return KErrArgument). sl@0: * @param aResult bool indicating whether the comparison was successful sl@0: * @return err code from Get() sl@0: */ sl@0: TInt GetOldVal(TValType aValType, TBool& aResult) sl@0: { sl@0: TInt intVal(0); sl@0: TReal realVal(0.0); sl@0: TBuf8<100> binVal; sl@0: TBuf16<100> strVal; sl@0: TUint32 metaVal(0); sl@0: sl@0: TInt err(KErrNone); sl@0: sl@0: switch (aValType) sl@0: { sl@0: case EIntVal: sl@0: err = TheRepository->Get(KIntKey, intVal); sl@0: aResult = (intVal == KOldIntVal); sl@0: break; sl@0: sl@0: case ERealVal: sl@0: err = TheRepository->Get(KRealKey, realVal); sl@0: aResult = (realVal == KOldRealVal); sl@0: break; sl@0: sl@0: case EBinaryVal: sl@0: err = TheRepository->Get(KBinKey, binVal); sl@0: aResult = (binVal == KOldBinVal); sl@0: break; sl@0: sl@0: case EStringVal: sl@0: err = TheRepository->Get(KStrKey, strVal); sl@0: aResult = (strVal == KOldStrVal); sl@0: break; sl@0: sl@0: case EMetaVal: sl@0: err = TheRepository->GetMeta(KIntKey, metaVal); sl@0: aResult = (metaVal == KIntMeta); sl@0: break; sl@0: sl@0: default: sl@0: err = KErrArgument; sl@0: break; sl@0: } sl@0: return err; sl@0: } sl@0: sl@0: sl@0: /** sl@0: * Common code for calling Get() with new values sl@0: * sl@0: * @param aValType enum indicating which data type to test sl@0: * (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will return KErrArgument). sl@0: * @param aTestType enum defining whether Set() or Create() is being tested sl@0: * (ESetTest or ECreateTest -- anything else will return KErrArgument). sl@0: * @param aResult bool indicating whether the comparison was successful sl@0: * @return err code from Get() sl@0: */ sl@0: TInt GetNewVal(TValType aValType, TTestType aTestType, TBool& aResult) sl@0: { sl@0: // check correct test type sl@0: if (aTestType != ECreateTest && aTestType != ESetTest) sl@0: { sl@0: return KErrArgument; sl@0: } sl@0: sl@0: TInt intVal(0); sl@0: TReal realVal(0.0); sl@0: TBuf8<100> binVal; sl@0: TBuf16<100> strVal; sl@0: sl@0: TInt err(KErrNone); sl@0: sl@0: switch (aValType) sl@0: { sl@0: case EIntVal: sl@0: err = TheRepository->Get( sl@0: (aTestType == ECreateTest ? KNewIntKey : KIntKey), intVal); sl@0: aResult = (intVal == KNewIntVal); sl@0: break; sl@0: sl@0: case ERealVal: sl@0: err = TheRepository->Get( sl@0: (aTestType == ECreateTest ? KNewRealKey : KRealKey), realVal); sl@0: aResult = (realVal == KNewRealVal); sl@0: break; sl@0: sl@0: case EBinaryVal: sl@0: err = TheRepository->Get( sl@0: (aTestType == ECreateTest ? KNewBinKey : KBinKey), binVal); sl@0: aResult = (binVal == KNewBinVal); sl@0: break; sl@0: sl@0: case EStringVal: sl@0: err = TheRepository->Get( sl@0: (aTestType == ECreateTest ? KNewStrKey : KStrKey), strVal); sl@0: aResult = (strVal == KNewStrVal); sl@0: break; sl@0: sl@0: case EMetaVal: sl@0: // no meta testing on new setting so fall through sl@0: sl@0: default: sl@0: err = KErrNotFound; sl@0: break; sl@0: } sl@0: return err; sl@0: } sl@0: sl@0: sl@0: /** sl@0: * Common code for calling Set() sl@0: * sl@0: * @param aValType enum indicating which data type to test sl@0: * (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will return KErrArgument). sl@0: * @return err code from Set() sl@0: */ sl@0: TInt SetNewVal(TValType aValType) sl@0: { sl@0: TInt err(KErrNone); sl@0: sl@0: switch (aValType) sl@0: { sl@0: case EIntVal: sl@0: err = TheRepository->Set(KIntKey, KNewIntVal); sl@0: break; sl@0: sl@0: case ERealVal: sl@0: err = TheRepository->Set(KRealKey, KNewRealVal); sl@0: break; sl@0: sl@0: case EBinaryVal: sl@0: err = TheRepository->Set(KBinKey, KNewBinVal); sl@0: break; sl@0: sl@0: case EStringVal: sl@0: err = TheRepository->Set(KStrKey, KNewStrVal); sl@0: break; sl@0: sl@0: case EMetaVal: sl@0: // no meta testing on new setting so fall through sl@0: sl@0: default: sl@0: err = KErrArgument; sl@0: break; sl@0: } sl@0: return err; sl@0: } sl@0: sl@0: sl@0: /** sl@0: * Common code for calling Create() sl@0: * sl@0: * @param aValType enum indicating which data type to test sl@0: * (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will return KErrArgument). sl@0: * @return err code from Create() sl@0: */ sl@0: TInt CreateNewSetting(TValType aValType) sl@0: { sl@0: TInt err(KErrNone); sl@0: sl@0: switch (aValType) sl@0: { sl@0: case EIntVal: sl@0: err = TheRepository->Create(KNewIntKey, KNewIntVal); sl@0: break; sl@0: sl@0: case ERealVal: sl@0: err = TheRepository->Create(KNewRealKey, KNewRealVal); sl@0: break; sl@0: sl@0: case EBinaryVal: sl@0: err = TheRepository->Create(KNewBinKey, KNewBinVal); sl@0: break; sl@0: sl@0: case EStringVal: sl@0: err = TheRepository->Create(KNewStrKey, KNewStrVal); sl@0: break; sl@0: sl@0: case EMetaVal: sl@0: // no meta testing on new setting so fall through sl@0: sl@0: default: sl@0: err = KErrArgument; sl@0: break; sl@0: } sl@0: return err; sl@0: } sl@0: sl@0: sl@0: /** sl@0: * Common code for calling Reset() sl@0: * sl@0: * @param aValType enum indicating which data type to test sl@0: * (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will return KErrArgument). sl@0: * @return err code from Reset() sl@0: */ sl@0: TInt ResetSetting(TValType aValType) sl@0: { sl@0: TInt err(KErrNone); sl@0: sl@0: switch (aValType) sl@0: { sl@0: case EIntVal: sl@0: err = TheRepository->Reset(KIntKey); sl@0: break; sl@0: sl@0: case ERealVal: sl@0: err = TheRepository->Reset(KRealKey); sl@0: break; sl@0: sl@0: case EBinaryVal: sl@0: err = TheRepository->Reset(KBinKey); sl@0: break; sl@0: sl@0: case EStringVal: sl@0: err = TheRepository->Reset(KStrKey); sl@0: break; sl@0: sl@0: case EMetaVal: sl@0: // no meta testing on new setting so fall through sl@0: sl@0: default: sl@0: err = KErrArgument; sl@0: break; sl@0: } sl@0: return err; sl@0: } sl@0: sl@0: sl@0: /** sl@0: * Common code for calling FindL() sl@0: * sl@0: * @param aStart Out parameter for start timer value sl@0: * @param aEnd Out parameter for end timer value sl@0: * @param aFound Out parameter for number of settings found sl@0: * @return err code from FindL() sl@0: */ sl@0: TInt FindRangeL(TInt& aStart, TInt& aEnd, TInt& aFound) sl@0: { sl@0: RArray keys; sl@0: CleanupClosePushL(keys); sl@0: sl@0: aStart = User::FastCounter(); sl@0: TInt err = TheRepository->FindL(KFindPartialKey, KFindMask, keys); sl@0: aEnd = User::FastCounter(); sl@0: sl@0: aFound = keys.Count(); sl@0: sl@0: CleanupStack::PopAndDestroy(&keys); sl@0: sl@0: return err; sl@0: } sl@0: sl@0: sl@0: /** sl@0: * Common code for performing all the Get() tests sl@0: * sl@0: * @param aValType enum indicating which data type to test sl@0: * (EIntVal, ERealVal, EBinaryVal, EStringVal or EMetaVal -- any other value will fail with KErrArgument). sl@0: * @param aUseTransaction bool instructing whether to use a read-mode transaction or not sl@0: */ sl@0: void DoGetTest(TValType aValType, TBool aUseTransaction = EFalse) sl@0: { sl@0: TInt err(KErrNone); sl@0: TInt result(EFalse); sl@0: TUint32 keyInfo(0); sl@0: sl@0: TUint32 start = User::FastCounter(); sl@0: sl@0: // start transaction, if required sl@0: err = aUseTransaction ? TheRepository->StartTransaction(CRepository::EReadTransaction) : err; sl@0: TEST2(err, KErrNone); sl@0: sl@0: err = GetOldVal(aValType, result); sl@0: TEST2(err, KErrNone); sl@0: sl@0: // end transaction, if required sl@0: err = aUseTransaction ? TheRepository->CommitTransaction(keyInfo) : err; sl@0: TEST2(err, KErrNone); sl@0: sl@0: TUint32 end = User::FastCounter(); sl@0: sl@0: TEST(result); sl@0: sl@0: PrintStats(start, end); sl@0: } sl@0: sl@0: sl@0: /** sl@0: * Common code for performing the Set() and Reset() tests for all datatypes sl@0: * sl@0: * @param aValType enum indicating which data type to test sl@0: * (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will fail with KErrArgument). sl@0: * @param aTestType enum defining whether Set() or Reset() should be timed sl@0: */ sl@0: void DoSetResetTest(TValType aValType, TTestType aTestType) sl@0: { sl@0: TInt err(KErrNone); sl@0: TInt result(EFalse); sl@0: sl@0: // Check we get the old expected value sl@0: err = GetOldVal(aValType, result); sl@0: TEST2(err, KErrNone); sl@0: TEST(result); sl@0: sl@0: TUint32 start(0); sl@0: TUint32 end(0); sl@0: sl@0: // Set the new value sl@0: start = aTestType == ESetTest ? User::FastCounter() : start; sl@0: err = SetNewVal(aValType); sl@0: end = aTestType == ESetTest ? User::FastCounter() : end; sl@0: TEST2(err, KErrNone); sl@0: sl@0: // Test we get the new value to check it's worked sl@0: err = GetNewVal(aValType, ESetTest, result); sl@0: TEST2(err, KErrNone); sl@0: TEST(result); sl@0: sl@0: // Restore the old value sl@0: start = aTestType == EResetTest ? User::FastCounter() : start; sl@0: err = ResetSetting(aValType); sl@0: end = aTestType == EResetTest ? User::FastCounter() : end; sl@0: TEST2(err, KErrNone); sl@0: sl@0: // Check reset's worked sl@0: err = GetOldVal(aValType, result); sl@0: TEST2(err, KErrNone); sl@0: TEST(result); sl@0: sl@0: PrintStats(start, end); sl@0: } sl@0: sl@0: sl@0: /** sl@0: * Common code for performing all the Create() tests sl@0: * sl@0: * @param aValType enum indicating which data type to test sl@0: * (EIntVal, ERealVal, EBinaryVal, EStringVal, EMetaVal -- any other value will fail with KErrArgument). sl@0: */ sl@0: void DoCreateTest(TValType aValType) sl@0: { sl@0: TInt err(KErrNone); sl@0: TInt result(EFalse); sl@0: sl@0: TUint32 start(0); sl@0: TUint32 end(0); sl@0: sl@0: // Create the new setting sl@0: start = User::FastCounter(); sl@0: err = CreateNewSetting(aValType); sl@0: end = User::FastCounter(); sl@0: TEST2(err, KErrNone); sl@0: sl@0: // Test we get the right value from the new setting to check it's worked sl@0: err = GetNewVal(aValType, ECreateTest, result); sl@0: TEST2(err, KErrNone); sl@0: TEST(result); sl@0: sl@0: PrintStats(start, end); sl@0: } sl@0: sl@0: sl@0: /** sl@0: * Common code for performing all the FindEqL() and FindNeqL() tests sl@0: * sl@0: * @param aValType enum indicating which data type to test sl@0: * (EIntVal, ERealVal, EBinaryVal, EStringVal, EMetaVal -- any other value will fail with KErrArgument). sl@0: * @param aTestType enum defining whether FindEqL() or FindNeqL() should be timed sl@0: * (EFindEqTest or EFindNeqTest -- anything else will leave with KErrArgument). sl@0: */ sl@0: void DoFindEqNeqTestL(TValType aValType, TTestType aTestType) sl@0: { sl@0: const TUint32 KPartialKey(0x8D800000); sl@0: const TUint32 KMask(0xFFF00000); sl@0: const TInt KFindNum(1); sl@0: const TInt KNotFindNum(15); sl@0: sl@0: const TInt KIntFindVal(9999); sl@0: const TReal KRealFindVal(999.9); sl@0: _LIT8(KBinFindVal, "\xab\xcd\x99\x99"); sl@0: _LIT(KStrFindVal, "abcd9999"); sl@0: sl@0: RArray results; sl@0: CleanupClosePushL(results); sl@0: sl@0: TInt expectedCount(0); sl@0: switch(aTestType) sl@0: { sl@0: case EFindEqTest: sl@0: expectedCount = KFindNum; sl@0: break; sl@0: sl@0: case EFindNeqTest: sl@0: expectedCount = KNotFindNum; sl@0: break; sl@0: sl@0: default: sl@0: // wrong test type passed in sl@0: User::Leave(KErrArgument); sl@0: } sl@0: sl@0: TInt err(KErrNone); sl@0: sl@0: TUint32 start = User::FastCounter(); sl@0: switch (aValType) sl@0: { sl@0: case EIntVal: sl@0: err = (aTestType == EFindEqTest) ? sl@0: TheRepository->FindEqL(KPartialKey, KMask, KIntFindVal, results) : sl@0: TheRepository->FindNeqL(KPartialKey, KMask, KIntFindVal, results); sl@0: break; sl@0: sl@0: case ERealVal: sl@0: err = (aTestType == EFindEqTest) ? sl@0: TheRepository->FindEqL(KPartialKey, KMask, KRealFindVal, results) : sl@0: TheRepository->FindNeqL(KPartialKey, KMask, KRealFindVal, results); sl@0: break; sl@0: sl@0: case EBinaryVal: sl@0: err = (aTestType == EFindEqTest) ? sl@0: TheRepository->FindEqL(KPartialKey, KMask, KBinFindVal, results) : sl@0: TheRepository->FindNeqL(KPartialKey, KMask, KBinFindVal, results); sl@0: break; sl@0: sl@0: case EStringVal: sl@0: err = (aTestType == EFindEqTest) ? sl@0: TheRepository->FindEqL(KPartialKey, KMask, KStrFindVal, results) : sl@0: TheRepository->FindNeqL(KPartialKey, KMask, KStrFindVal, results); sl@0: break; sl@0: sl@0: case EMetaVal: sl@0: // no meta testing on new setting so fall through sl@0: sl@0: default: sl@0: err = KErrArgument; sl@0: break; sl@0: } sl@0: TUint32 end = User::FastCounter(); sl@0: sl@0: // Test there was no error and that we found the expected number sl@0: TEST2(err, KErrNone); sl@0: TEST(results.Count() == expectedCount); sl@0: sl@0: CleanupStack::PopAndDestroy(&results); sl@0: sl@0: PrintStats(start, end); sl@0: } sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////////////// sl@0: /////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: // TEST CASES sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-UT-4047 sl@0: @SYMTestCaseDesc CRepository::Get(TUint32 aKey, TInt& aValue) - performance test sl@0: The test measures the time needed for retrieving of a single integer setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Get(TUint32 aKey, TInt& aValue) - performance test sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMDEF DEF128986 sl@0: */ sl@0: void GetIntTest() sl@0: { sl@0: DoGetTest(EIntVal); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4087 sl@0: @SYMTestCaseDesc CRepository::Get(TUint32 aKey, TReal& aValue) - performance test sl@0: The test measures the time needed for retrieving of a single real setting, sl@0: witht the Get() wrapped in a read-mode transaction. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Get(TUint32 aKey, TReal& aValue) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void GetRealTest() sl@0: { sl@0: DoGetTest(ERealVal, ETrue); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-UT-4048 sl@0: @SYMTestCaseDesc CRepository::Get(TUint32 aKey, TDes8& aValue) - performance test sl@0: The test measures the time needed for retrieving of a single 8-bit string setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Get(TUint32 aKey, TDes8& aValue) - performance test sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMDEF DEF128986 sl@0: */ sl@0: void GetBinaryTest() sl@0: { sl@0: DoGetTest(EBinaryVal); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4088 sl@0: @SYMTestCaseDesc CRepository::Get(TUint32 aKey, TDes8& aValue) - performance test sl@0: The test measures the time needed for retrieving of a single 8-bit string setting, sl@0: with the Get() wrapped in a read-mode transaction. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Get(TUint32 aKey, TDes8& aValue) sl@0: CRepository::StartTransaction(TTransactionMode aMode) sl@0: CRepository::CommitTransaction(TUint32 &aKeyInfo) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void GetBinaryInTransactionTest() sl@0: { sl@0: DoGetTest(EBinaryVal, ETrue); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4089 sl@0: @SYMTestCaseDesc CRepository::Get(TUint32 aKey, TDesC16& aValue) - performance test sl@0: The test measures the time needed for retrieving of a single 16-bit string setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Get(TUint32 aKey, TDesC16& aValue) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void GetStringTest() sl@0: { sl@0: DoGetTest(EStringVal, ETrue); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4090 sl@0: @SYMTestCaseDesc CRepository::GetMeta(TUint32 aKey, TUint32& aMeta) - performance test sl@0: The test measures the time needed for retrieving metadata for a single setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::GetMeta(TUint32 aKey, TUint32& aMeta) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void GetMetaTest() sl@0: { sl@0: DoGetTest(EMetaVal, ETrue); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4091 sl@0: @SYMTestCaseDesc CRepository::Set(TUint32 aKey, TInt aValue) - performance test sl@0: The test measures the time needed for setting a single integer setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Set(TUint32 aKey, TInt aValue) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void SetIntTest() sl@0: { sl@0: DoSetResetTest(EIntVal, ESetTest); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4092 sl@0: @SYMTestCaseDesc CRepository::Set(TUint32 aKey, TReal aValue) - performance test sl@0: The test measures the time needed for setting a single real setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Set(TUint32 aKey, TReal aValue) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void SetRealTest() sl@0: { sl@0: DoSetResetTest(ERealVal, ESetTest); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4093 sl@0: @SYMTestCaseDesc CRepository::Set(TUint32 aKey, TDes8& aValue) - performance test sl@0: The test measures the time needed for setting a single 8-bit string setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Set(TUint32 aKey, TDes8& aValue) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void SetBinaryTest() sl@0: { sl@0: DoSetResetTest(EBinaryVal, ESetTest); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4094 sl@0: @SYMTestCaseDesc CRepository::Set(TUint32 aKey, TDesC16& aValue) - performance test sl@0: The test measures the time needed for setting a single 16-bit string setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Set(TUint32 aKey, TDesC16& aValue) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void SetStringTest() sl@0: { sl@0: DoSetResetTest(EStringVal, ESetTest); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4095 sl@0: @SYMTestCaseDesc CRepository::Create(TUint32 aKey, TInt aValue) - performance test sl@0: The test measures the time needed for creating a new single integer setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Create(TUint32 aKey, TInt aValue) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void CreateIntTest() sl@0: { sl@0: DoCreateTest(EIntVal); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4096 sl@0: @SYMTestCaseDesc CRepository::Create(TUint32 aKey, TReal aValue) - performance test sl@0: The test measures the time needed for creating a new single real setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Create(TUint32 aKey, TReal aValue) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void CreateRealTest() sl@0: { sl@0: DoCreateTest(ERealVal); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4097 sl@0: @SYMTestCaseDesc CRepository::Create(TUint32 aKey, TDesC8& aValue) - performance test sl@0: The test measures the time needed for creating a new single 8-bit string setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Create(TUint32 aKey, TDesC8& aValue) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void CreateBinaryTest() sl@0: { sl@0: DoCreateTest(EBinaryVal); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4098 sl@0: @SYMTestCaseDesc CRepository::Create(TUint32 aKey, TDesC16& aValue) - performance test sl@0: The test measures the time needed for creating a new single 16-bit string setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Create(TUint32 aKey, TDesC16& aValue) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void CreateStringTest() sl@0: { sl@0: DoCreateTest(EStringVal); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-UT-4049 sl@0: @SYMTestCaseDesc CRepository::FindL(TUint32 aPartialKey, TUint32 aMask, RArray& aFoundKeys) - performance test sl@0: The test measures the time needed for retrieving of an array of keys matching the function arguments. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::FindL(TUint32 aPartialKey, TUint32 aMask, RArray& aFoundKeys) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMDEF DEF128986 sl@0: */ sl@0: void FindTestL() sl@0: { sl@0: TInt start(0); sl@0: TInt end(0); sl@0: TInt found(0); sl@0: sl@0: TInt err = FindRangeL(start, end, found); sl@0: sl@0: TEST2(err, KErrNone); sl@0: TEST2(found, KFindKeyCount); sl@0: sl@0: PrintStats(start, end); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4099 sl@0: @SYMTestCaseDesc CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TInt aValue, RArray< TUint32 > &aFoundKeys) - performance test sl@0: The test measures the time to find an int setting in an "equals" search on a range. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TInt aValue, RArray< TUint32 > &aFoundKeys) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void FindEqIntTestL() sl@0: { sl@0: DoFindEqNeqTestL(EIntVal, EFindEqTest); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4100 sl@0: @SYMTestCaseDesc CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TReal aValue, RArray< TUint32 > &aFoundKeys) - performance test sl@0: The test measures the time to find a real setting in an "equals" search on a range. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TReal aValue, RArray< TUint32 > &aFoundKeys) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void FindEqRealTestL() sl@0: { sl@0: DoFindEqNeqTestL(ERealVal, EFindEqTest); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4101 sl@0: @SYMTestCaseDesc CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TDesC8& aValue, RArray< TUint32 > &aFoundKeys) - performance test sl@0: The test measures the time to find an 8-bit string setting in an "equals" search on a range. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TDesC8& aValue, RArray< TUint32 > &aFoundKeys) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void FindEqBinaryTestL() sl@0: { sl@0: DoFindEqNeqTestL(EBinaryVal, EFindEqTest); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4102 sl@0: @SYMTestCaseDesc CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TDesC16& aValue, RArray< TUint32 > &aFoundKeys) - performance test sl@0: The test measures the time to find an 16-bit string setting in an "equals" search on a range. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TDesC16& aValue, RArray< TUint32 > &aFoundKeys) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void FindEqStringTestL() sl@0: { sl@0: DoFindEqNeqTestL(EStringVal, EFindEqTest); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4103 sl@0: @SYMTestCaseDesc CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TInt aValue, RArray< TUint32 > &aFoundKeys) - performance test sl@0: The test measures the time to find an int setting in an "not equals" search on a range. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TInt aValue, RArray< TUint32 > &aFoundKeys) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void FindNeqIntTestL() sl@0: { sl@0: DoFindEqNeqTestL(EIntVal, EFindNeqTest); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4104 sl@0: @SYMTestCaseDesc CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TReal aValue, RArray< TUint32 > &aFoundKeys) - performance test sl@0: The test measures the time to find a real setting in an "not equals" search on a range. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TReal aValue, RArray< TUint32 > &aFoundKeys) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void FindNeqRealTestL() sl@0: { sl@0: DoFindEqNeqTestL(ERealVal, EFindNeqTest); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4105 sl@0: @SYMTestCaseDesc CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TDesC8& aValue, RArray< TUint32 > &aFoundKeys) - performance test sl@0: The test measures the time to find an 8-bit string setting in an "not equals" search on a range. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TDesC8& aValue, RArray< TUint32 > &aFoundKeys) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void FindNeqBinaryTestL() sl@0: { sl@0: DoFindEqNeqTestL(EBinaryVal, EFindNeqTest); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4106 sl@0: @SYMTestCaseDesc CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TDesC16& aValue, RArray< TUint32 > &aFoundKeys) - performance test sl@0: The test measures the time to find an 16-bit string setting in an "not equals" search on a range. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TDesC16& aValue, RArray< TUint32 > &aFoundKeys) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void FindNeqStringTestL() sl@0: { sl@0: DoFindEqNeqTestL(EStringVal, EFindNeqTest); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4107 sl@0: @SYMTestCaseDesc Performance test that measures the time taken to retrieve data to rebuild a table of ints with 22 rows sl@0: and 8 columns, using successive calls of Find() with subsequent calls to Get for each key retrieved. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::FindL(TUint32 aPartialKey, TUint32 aMask, RArray& aFoundKeys) sl@0: CRepository::Get(TUint32 aPartialKey, TUint32 aMask, RArray& aFoundKeys) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void RetrieveTableTestL() sl@0: { sl@0: TUint32 partialKeyData[] = { sl@0: 0x03950000, 0x03980000, 0x039A0000, 0x039E0000, 0x03A80000, 0x03A90000, sl@0: 0x03AA0000, 0x03AB0000, 0x03B50000, 0x03B60000, 0x03B70000, 0x03B80000, sl@0: 0x03B90000, 0x03BA0000, 0x03BB0000, 0x03BC0000, 0x03BD0000, 0x03BE0000, sl@0: 0x03BF0000, 0x03C00000, 0x03C10000, 0x03C20000 sl@0: }; sl@0: const TInt KNumRows(22); // same as number of partialKeys in array above sl@0: const TInt KNumCols(8); // expected number of columns per row sl@0: const TUint32 KMask(0xFFFF0000); // match top 2 bytes sl@0: sl@0: RArray rowKeys(KNumCols); // set granularity to num cols sl@0: CleanupClosePushL(rowKeys); sl@0: sl@0: TUint32 start = User::FastCounter(); sl@0: sl@0: for (TInt i(0); i < KNumRows; ++i) sl@0: { sl@0: // fetch all keys representing columns/cells in the row sl@0: // matching the key range defined by the partial key sl@0: TInt findErr = TheRepository->FindL(partialKeyData[i], KMask, rowKeys); sl@0: TEST2(findErr, KErrNone); sl@0: sl@0: const TInt KColCount = rowKeys.Count(); sl@0: TEST(KColCount == KNumCols); sl@0: sl@0: // retrieve data for each column/cell represented sl@0: // by a key from the row key range sl@0: TInt value(KErrNotFound); sl@0: for (TInt j(0); j < KColCount; ++j) sl@0: { sl@0: TInt getErr = TheRepository->Get(rowKeys[j], value); sl@0: TEST2(getErr, KErrNone); sl@0: sl@0: // data for these cells are 0 or 1 sl@0: TEST(value == 0 || value == 1); sl@0: } sl@0: sl@0: // clear our keys array for next row sl@0: rowKeys.Reset(); sl@0: } sl@0: sl@0: TUint32 end = User::FastCounter(); sl@0: PrintStats(start, end); sl@0: sl@0: CleanupStack::PopAndDestroy(&rowKeys); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4108 sl@0: @SYMTestCaseDesc CRepository::Move(TUint32 aSourcePartialKey, TUint32 aTargetPartialKey, TUint32 aMask, TUint32 &aErrorKey) - performance test sl@0: The test measures the time needed for moving a single integer setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Move(TUint32 aSourcePartialKey, TUint32 aTargetPartialKey, TUint32 aMask, TUint32 &aErrorKey) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void MoveTest() sl@0: { sl@0: TUint32 errorKey(0); sl@0: sl@0: // Move a setting to a new key sl@0: TUint32 start = User::FastCounter(); sl@0: TInt err = TheRepository->Move(KNewIntKey, KNewIntKey2, 0xFFFFFFFF, errorKey); sl@0: TUint32 end = User::FastCounter(); sl@0: TEST2(err, KErrNone); sl@0: sl@0: // Test we get the right value from the new location sl@0: TInt val(0); sl@0: err = TheRepository->Get(KNewIntKey2, val); sl@0: TEST2(err, KErrNone); sl@0: TEST2(val, KNewIntVal); sl@0: sl@0: // Test we get the KErrNotFound from the old location sl@0: err = TheRepository->Get(KNewIntKey, val); sl@0: TEST2(err, KErrNotFound); sl@0: sl@0: PrintStats(start, end); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4109 sl@0: @SYMTestCaseDesc CRepository::Delete(TUint32 aKey) - performance test sl@0: The test measures the time needed for deleting a single setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Delete(TUint32 aKey) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void DeleteTest() sl@0: { sl@0: // Test the setting is there and we get the right value sl@0: TInt val(0); sl@0: TInt err = TheRepository->Get(KNewIntKey2, val); sl@0: TEST2(err, KErrNone); sl@0: TEST2(val, KNewIntVal); sl@0: sl@0: // Delete the setting sl@0: TUint32 start = User::FastCounter(); sl@0: err = TheRepository->Delete(KNewIntKey2); sl@0: TUint32 end = User::FastCounter(); sl@0: TEST2(err, KErrNone); sl@0: sl@0: // Test we get the KErrNotFound from the key now sl@0: err = TheRepository->Get(KNewIntKey2, val); sl@0: TEST2(err, KErrNotFound); sl@0: sl@0: PrintStats(start, end); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4110 sl@0: @SYMTestCaseDesc CRepository::Delete(TUint32 aKey) - performance test sl@0: The test measures the time needed for deleting a single setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Delete(TUint32 aKey) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void DeleteRangeTestL() sl@0: { sl@0: TInt start(0); sl@0: TInt end(0); sl@0: TInt found(0); sl@0: sl@0: // Check we can find the settings in the range sl@0: // (ignore timing data here as we're not timing find) sl@0: TInt err = FindRangeL(start, end, found); sl@0: TEST2(err, KErrNone); sl@0: TEST2(found, KFindKeyCount); sl@0: sl@0: // Delete the setting sl@0: TUint32 errorKey(0); sl@0: start = User::FastCounter(); sl@0: err = TheRepository->Delete(KFindPartialKey, KFindMask, errorKey); sl@0: end = User::FastCounter(); sl@0: TEST2(err, KErrNone); sl@0: sl@0: // Check we *can't* find the settings in the range now they've been deleted sl@0: err = FindRangeL(start, end, found); sl@0: TEST2(err, KErrNotFound); sl@0: sl@0: PrintStats(start, end); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4111 sl@0: @SYMTestCaseDesc CRepository::Reset(TUint32 aKey) - performance test sl@0: The test measures the time needed for resetting a single integer setting. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Reset(TUint32 aKey) sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void ResetTest() sl@0: { sl@0: DoSetResetTest(EIntVal, EResetTest); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4112 sl@0: @SYMTestCaseDesc CRepository::Reset() - performance test sl@0: The test measures the time needed for resetting the whole keyspace. sl@0: @SYMTestPriority High sl@0: @SYMTestActions CRepository::Reset() sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMPREQ PREQ2505 sl@0: @SYMREQ REQ13142 sl@0: */ sl@0: void ResetAllTest() sl@0: { sl@0: // Check we can get the value of the newly created binary setting sl@0: TBool result; sl@0: TInt err = GetNewVal(EBinaryVal, ECreateTest, result); sl@0: TEST2(err, KErrNone); sl@0: TEST(result); sl@0: sl@0: // Reset the whole keyspace sl@0: TInt start = User::FastCounter(); sl@0: TheRepository->Reset(); sl@0: TInt end = User::FastCounter(); sl@0: TEST2(err, KErrNone); sl@0: sl@0: // Check we *can't* get the value of the newly created binary setting sl@0: // since it shouldn't exist anymore after the Reset() sl@0: err = GetNewVal(EBinaryVal, ECreateTest, result); sl@0: TEST2(err, KErrNotFound); sl@0: PrintStats(start, end); sl@0: } sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: // MAIN sl@0: sl@0: void DoTestsL() sl@0: { sl@0: TheTest.Start(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-UT-4047 Get Int test")); sl@0: GetIntTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4087 Get Real test")); sl@0: GetRealTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-UT-4048 Get Binary test")); sl@0: GetBinaryTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4088 Get Binary in Transaction test")); sl@0: GetBinaryInTransactionTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4089 Get String test")); sl@0: GetStringTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4090 GetMeta test")); sl@0: GetMetaTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4091 Set Int test")); sl@0: SetIntTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4092 Set Real test")); sl@0: SetRealTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4093 Set Binary test")); sl@0: SetBinaryTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4094 Set String test")); sl@0: SetStringTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4095 Create Int setting test")); sl@0: CreateIntTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4096 Create Real setting test")); sl@0: CreateRealTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4097 Create Binary setting test")); sl@0: CreateBinaryTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4098 Create String setting test")); sl@0: CreateStringTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-UT-4049 Find test")); sl@0: FindTestL(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4099 FindEq Int test")); sl@0: FindEqIntTestL(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4100 FindEq Real test")); sl@0: FindEqRealTestL(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4101 FindEq Binary test")); sl@0: FindEqBinaryTestL(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4102 FindEq String test")); sl@0: FindEqStringTestL(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4103 FindNeq Int test")); sl@0: FindNeqIntTestL(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4104 FindNeq Real test")); sl@0: FindNeqRealTestL(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4105 FindNeq Binary test")); sl@0: FindNeqBinaryTestL(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4106 FindNeq String test")); sl@0: FindNeqStringTestL(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4107 Retrieve structured data table test")); sl@0: RetrieveTableTestL(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4108 Move test")); sl@0: MoveTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4109 Delete test")); sl@0: DeleteTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4110 Delete test")); sl@0: DeleteRangeTestL(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4111 Reset Single test")); sl@0: ResetTest(); sl@0: sl@0: TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4112 Reset All test")); sl@0: ResetAllTest(); sl@0: } sl@0: sl@0: sl@0: TInt E32Main() sl@0: { sl@0: TheTest.Title(); sl@0: sl@0: CTrapCleanup* tc = CTrapCleanup::New(); sl@0: TheTest(tc != NULL); sl@0: sl@0: __UHEAP_MARK; sl@0: sl@0: TRAPD(err, CreateTestEnvL()); sl@0: TEST2(err, KErrNone); sl@0: sl@0: TRAP(err, DoTestsL()); sl@0: DestroyTestEnv(); sl@0: TEST2(err, KErrNone); sl@0: sl@0: __UHEAP_MARKEND; sl@0: sl@0: TheTest.End(); sl@0: TheTest.Close(); sl@0: sl@0: delete tc; sl@0: sl@0: User::Heap().Check(); sl@0: return KErrNone; sl@0: }