sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <centralrepository.h>
|
sl@0
|
17 |
#include <e32test.h>
|
sl@0
|
18 |
#include <f32file.h>
|
sl@0
|
19 |
#include <bautils.h>
|
sl@0
|
20 |
#include <hal.h>
|
sl@0
|
21 |
|
sl@0
|
22 |
RTest TheTest(_L("t_cenrep_perf test"));
|
sl@0
|
23 |
CRepository* TheRepository = NULL;
|
sl@0
|
24 |
const TUid KTestCenRepUid = {0xCCCCCC03};
|
sl@0
|
25 |
_LIT(KFileName, "c:\\private\\10202be9\\persists\\cccccc03.cre");
|
sl@0
|
26 |
|
sl@0
|
27 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
28 |
|
sl@0
|
29 |
// Shared test data
|
sl@0
|
30 |
|
sl@0
|
31 |
enum TValType {EIntVal, ERealVal, EBinaryVal, EStringVal, EMetaVal};
|
sl@0
|
32 |
enum TTestType {ESetTest, ECreateTest, EFindEqTest, EFindNeqTest, EResetTest};
|
sl@0
|
33 |
|
sl@0
|
34 |
// int
|
sl@0
|
35 |
const TUint32 KIntKey = 42011136ul;
|
sl@0
|
36 |
const TUint32 KNewIntKey = 2374040320ul;
|
sl@0
|
37 |
const TUint32 KNewIntKey2 = 2374040576ul;
|
sl@0
|
38 |
const TInt KOldIntVal = 10;
|
sl@0
|
39 |
const TInt KNewIntVal = KOldIntVal + 1;
|
sl@0
|
40 |
const TUint32 KIntMeta = 0;
|
sl@0
|
41 |
|
sl@0
|
42 |
// real
|
sl@0
|
43 |
const TUint32 KRealKey = 2374041088ul;
|
sl@0
|
44 |
const TUint32 KNewRealKey = 2374041344ul;
|
sl@0
|
45 |
const TReal KOldRealVal = 0.1;
|
sl@0
|
46 |
const TReal KNewRealVal = KOldRealVal + 1.0;
|
sl@0
|
47 |
|
sl@0
|
48 |
// binary
|
sl@0
|
49 |
const TUint32 KBinKey = 42141952ul;
|
sl@0
|
50 |
const TUint32 KNewBinKey = 2374040832ul;
|
sl@0
|
51 |
_LIT8(KOldBinVal, "\x44\x00\x69\x00\x61\x00\x6c\x00\x4f\x00\x75\x00\x74\x00\x49\x00\x53\x00\x50\x00");
|
sl@0
|
52 |
_LIT8(KNewBinVal, "\x44\x00\x69\x00\x61\x00\x6c\x00\x4f\x00\x75\x00\x74\x00\x49\x00\x53\x00\x50\x01");
|
sl@0
|
53 |
|
sl@0
|
54 |
// string
|
sl@0
|
55 |
const TUint32 KStrKey = 2374041600ul;
|
sl@0
|
56 |
const TUint32 KNewStrKey = 2374041856ul;
|
sl@0
|
57 |
_LIT(KOldStrVal, "hello");
|
sl@0
|
58 |
_LIT(KNewStrVal, "goodbye");
|
sl@0
|
59 |
|
sl@0
|
60 |
|
sl@0
|
61 |
// FindL range data
|
sl@0
|
62 |
const TUint32 KFindPartialKey = 0x08440000ul;
|
sl@0
|
63 |
const TUint32 KFindMask = 0x0FFF0000ul;
|
sl@0
|
64 |
const TInt KFindKeyCount = 15;
|
sl@0
|
65 |
|
sl@0
|
66 |
|
sl@0
|
67 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
68 |
|
sl@0
|
69 |
TInt DeleteCreFile()
|
sl@0
|
70 |
{
|
sl@0
|
71 |
RFs fs;
|
sl@0
|
72 |
fs.Connect();
|
sl@0
|
73 |
TInt err = fs.Delete(KFileName);
|
sl@0
|
74 |
fs.Close();
|
sl@0
|
75 |
|
sl@0
|
76 |
// it's fine if the file or path wasn't found as there's nothing to
|
sl@0
|
77 |
// delete so return KErrNone
|
sl@0
|
78 |
return (err == KErrNotFound || err == KErrPathNotFound) ? KErrNone : err;
|
sl@0
|
79 |
}
|
sl@0
|
80 |
|
sl@0
|
81 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
82 |
|
sl@0
|
83 |
void DestroyTestEnv()
|
sl@0
|
84 |
{
|
sl@0
|
85 |
delete TheRepository;
|
sl@0
|
86 |
|
sl@0
|
87 |
// delete the CRE file to clear out any changes made during the test
|
sl@0
|
88 |
DeleteCreFile();
|
sl@0
|
89 |
}
|
sl@0
|
90 |
|
sl@0
|
91 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
92 |
|
sl@0
|
93 |
//Test macros and functions
|
sl@0
|
94 |
void Check(TInt aValue, TInt aLine)
|
sl@0
|
95 |
{
|
sl@0
|
96 |
if(!aValue)
|
sl@0
|
97 |
{
|
sl@0
|
98 |
DestroyTestEnv();
|
sl@0
|
99 |
RDebug::Print(_L("*** Test failure. Boolean expression evaluates to false.\r\n"));
|
sl@0
|
100 |
TheTest(EFalse, aLine);
|
sl@0
|
101 |
}
|
sl@0
|
102 |
}
|
sl@0
|
103 |
void Check2(TInt aValue, TInt aExpected, TInt aLine)
|
sl@0
|
104 |
{
|
sl@0
|
105 |
if(aValue != aExpected)
|
sl@0
|
106 |
{
|
sl@0
|
107 |
DestroyTestEnv();
|
sl@0
|
108 |
RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
|
sl@0
|
109 |
TheTest(EFalse, aLine);
|
sl@0
|
110 |
}
|
sl@0
|
111 |
}
|
sl@0
|
112 |
#define TEST(arg) ::Check((arg), __LINE__)
|
sl@0
|
113 |
#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
|
sl@0
|
114 |
|
sl@0
|
115 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
116 |
|
sl@0
|
117 |
// leaves if it can't successfully delete the cre file if it exists
|
sl@0
|
118 |
void CreateTestEnvL()
|
sl@0
|
119 |
{
|
sl@0
|
120 |
// delete the CRE file to clear out any changes leftover from previous test runs
|
sl@0
|
121 |
User::LeaveIfError(DeleteCreFile());
|
sl@0
|
122 |
|
sl@0
|
123 |
TRAPD(err, TheRepository = CRepository::NewL(KTestCenRepUid));
|
sl@0
|
124 |
TEST2(err, KErrNone);
|
sl@0
|
125 |
}
|
sl@0
|
126 |
|
sl@0
|
127 |
|
sl@0
|
128 |
//Prints aTicks parameter (converted to us)
|
sl@0
|
129 |
void PrintStats(TUint32 aStartTicks, TUint32 aEndTicks)
|
sl@0
|
130 |
{
|
sl@0
|
131 |
static TInt freq = 0;
|
sl@0
|
132 |
if(freq == 0)
|
sl@0
|
133 |
{
|
sl@0
|
134 |
TEST2(HAL::Get(HAL::EFastCounterFrequency, freq), KErrNone);
|
sl@0
|
135 |
}
|
sl@0
|
136 |
TInt64 diffTicks = (TInt64)aEndTicks - (TInt64)aStartTicks;
|
sl@0
|
137 |
if(diffTicks < 0)
|
sl@0
|
138 |
{
|
sl@0
|
139 |
diffTicks = KMaxTUint32 + diffTicks + 1;
|
sl@0
|
140 |
}
|
sl@0
|
141 |
const TInt KMicroSecIn1Sec = 1000000;
|
sl@0
|
142 |
TInt32 us = (diffTicks * KMicroSecIn1Sec) / freq;
|
sl@0
|
143 |
TheTest.Printf(_L("####Execution time: %d us\r\n"), us);
|
sl@0
|
144 |
}
|
sl@0
|
145 |
|
sl@0
|
146 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
147 |
|
sl@0
|
148 |
// Utility functions containing code common to multiple test cases
|
sl@0
|
149 |
|
sl@0
|
150 |
/**
|
sl@0
|
151 |
* Common code for calling Get() with old values
|
sl@0
|
152 |
*
|
sl@0
|
153 |
* @param aValType enum indicating which data type to test
|
sl@0
|
154 |
* (EIntVal, ERealVal, EBinaryVal, EStringVal or EMetaVal-- any other value will return KErrArgument).
|
sl@0
|
155 |
* @param aResult bool indicating whether the comparison was successful
|
sl@0
|
156 |
* @return err code from Get()
|
sl@0
|
157 |
*/
|
sl@0
|
158 |
TInt GetOldVal(TValType aValType, TBool& aResult)
|
sl@0
|
159 |
{
|
sl@0
|
160 |
TInt intVal(0);
|
sl@0
|
161 |
TReal realVal(0.0);
|
sl@0
|
162 |
TBuf8<100> binVal;
|
sl@0
|
163 |
TBuf16<100> strVal;
|
sl@0
|
164 |
TUint32 metaVal(0);
|
sl@0
|
165 |
|
sl@0
|
166 |
TInt err(KErrNone);
|
sl@0
|
167 |
|
sl@0
|
168 |
switch (aValType)
|
sl@0
|
169 |
{
|
sl@0
|
170 |
case EIntVal:
|
sl@0
|
171 |
err = TheRepository->Get(KIntKey, intVal);
|
sl@0
|
172 |
aResult = (intVal == KOldIntVal);
|
sl@0
|
173 |
break;
|
sl@0
|
174 |
|
sl@0
|
175 |
case ERealVal:
|
sl@0
|
176 |
err = TheRepository->Get(KRealKey, realVal);
|
sl@0
|
177 |
aResult = (realVal == KOldRealVal);
|
sl@0
|
178 |
break;
|
sl@0
|
179 |
|
sl@0
|
180 |
case EBinaryVal:
|
sl@0
|
181 |
err = TheRepository->Get(KBinKey, binVal);
|
sl@0
|
182 |
aResult = (binVal == KOldBinVal);
|
sl@0
|
183 |
break;
|
sl@0
|
184 |
|
sl@0
|
185 |
case EStringVal:
|
sl@0
|
186 |
err = TheRepository->Get(KStrKey, strVal);
|
sl@0
|
187 |
aResult = (strVal == KOldStrVal);
|
sl@0
|
188 |
break;
|
sl@0
|
189 |
|
sl@0
|
190 |
case EMetaVal:
|
sl@0
|
191 |
err = TheRepository->GetMeta(KIntKey, metaVal);
|
sl@0
|
192 |
aResult = (metaVal == KIntMeta);
|
sl@0
|
193 |
break;
|
sl@0
|
194 |
|
sl@0
|
195 |
default:
|
sl@0
|
196 |
err = KErrArgument;
|
sl@0
|
197 |
break;
|
sl@0
|
198 |
}
|
sl@0
|
199 |
return err;
|
sl@0
|
200 |
}
|
sl@0
|
201 |
|
sl@0
|
202 |
|
sl@0
|
203 |
/**
|
sl@0
|
204 |
* Common code for calling Get() with new values
|
sl@0
|
205 |
*
|
sl@0
|
206 |
* @param aValType enum indicating which data type to test
|
sl@0
|
207 |
* (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will return KErrArgument).
|
sl@0
|
208 |
* @param aTestType enum defining whether Set() or Create() is being tested
|
sl@0
|
209 |
* (ESetTest or ECreateTest -- anything else will return KErrArgument).
|
sl@0
|
210 |
* @param aResult bool indicating whether the comparison was successful
|
sl@0
|
211 |
* @return err code from Get()
|
sl@0
|
212 |
*/
|
sl@0
|
213 |
TInt GetNewVal(TValType aValType, TTestType aTestType, TBool& aResult)
|
sl@0
|
214 |
{
|
sl@0
|
215 |
// check correct test type
|
sl@0
|
216 |
if (aTestType != ECreateTest && aTestType != ESetTest)
|
sl@0
|
217 |
{
|
sl@0
|
218 |
return KErrArgument;
|
sl@0
|
219 |
}
|
sl@0
|
220 |
|
sl@0
|
221 |
TInt intVal(0);
|
sl@0
|
222 |
TReal realVal(0.0);
|
sl@0
|
223 |
TBuf8<100> binVal;
|
sl@0
|
224 |
TBuf16<100> strVal;
|
sl@0
|
225 |
|
sl@0
|
226 |
TInt err(KErrNone);
|
sl@0
|
227 |
|
sl@0
|
228 |
switch (aValType)
|
sl@0
|
229 |
{
|
sl@0
|
230 |
case EIntVal:
|
sl@0
|
231 |
err = TheRepository->Get(
|
sl@0
|
232 |
(aTestType == ECreateTest ? KNewIntKey : KIntKey), intVal);
|
sl@0
|
233 |
aResult = (intVal == KNewIntVal);
|
sl@0
|
234 |
break;
|
sl@0
|
235 |
|
sl@0
|
236 |
case ERealVal:
|
sl@0
|
237 |
err = TheRepository->Get(
|
sl@0
|
238 |
(aTestType == ECreateTest ? KNewRealKey : KRealKey), realVal);
|
sl@0
|
239 |
aResult = (realVal == KNewRealVal);
|
sl@0
|
240 |
break;
|
sl@0
|
241 |
|
sl@0
|
242 |
case EBinaryVal:
|
sl@0
|
243 |
err = TheRepository->Get(
|
sl@0
|
244 |
(aTestType == ECreateTest ? KNewBinKey : KBinKey), binVal);
|
sl@0
|
245 |
aResult = (binVal == KNewBinVal);
|
sl@0
|
246 |
break;
|
sl@0
|
247 |
|
sl@0
|
248 |
case EStringVal:
|
sl@0
|
249 |
err = TheRepository->Get(
|
sl@0
|
250 |
(aTestType == ECreateTest ? KNewStrKey : KStrKey), strVal);
|
sl@0
|
251 |
aResult = (strVal == KNewStrVal);
|
sl@0
|
252 |
break;
|
sl@0
|
253 |
|
sl@0
|
254 |
case EMetaVal:
|
sl@0
|
255 |
// no meta testing on new setting so fall through
|
sl@0
|
256 |
|
sl@0
|
257 |
default:
|
sl@0
|
258 |
err = KErrNotFound;
|
sl@0
|
259 |
break;
|
sl@0
|
260 |
}
|
sl@0
|
261 |
return err;
|
sl@0
|
262 |
}
|
sl@0
|
263 |
|
sl@0
|
264 |
|
sl@0
|
265 |
/**
|
sl@0
|
266 |
* Common code for calling Set()
|
sl@0
|
267 |
*
|
sl@0
|
268 |
* @param aValType enum indicating which data type to test
|
sl@0
|
269 |
* (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will return KErrArgument).
|
sl@0
|
270 |
* @return err code from Set()
|
sl@0
|
271 |
*/
|
sl@0
|
272 |
TInt SetNewVal(TValType aValType)
|
sl@0
|
273 |
{
|
sl@0
|
274 |
TInt err(KErrNone);
|
sl@0
|
275 |
|
sl@0
|
276 |
switch (aValType)
|
sl@0
|
277 |
{
|
sl@0
|
278 |
case EIntVal:
|
sl@0
|
279 |
err = TheRepository->Set(KIntKey, KNewIntVal);
|
sl@0
|
280 |
break;
|
sl@0
|
281 |
|
sl@0
|
282 |
case ERealVal:
|
sl@0
|
283 |
err = TheRepository->Set(KRealKey, KNewRealVal);
|
sl@0
|
284 |
break;
|
sl@0
|
285 |
|
sl@0
|
286 |
case EBinaryVal:
|
sl@0
|
287 |
err = TheRepository->Set(KBinKey, KNewBinVal);
|
sl@0
|
288 |
break;
|
sl@0
|
289 |
|
sl@0
|
290 |
case EStringVal:
|
sl@0
|
291 |
err = TheRepository->Set(KStrKey, KNewStrVal);
|
sl@0
|
292 |
break;
|
sl@0
|
293 |
|
sl@0
|
294 |
case EMetaVal:
|
sl@0
|
295 |
// no meta testing on new setting so fall through
|
sl@0
|
296 |
|
sl@0
|
297 |
default:
|
sl@0
|
298 |
err = KErrArgument;
|
sl@0
|
299 |
break;
|
sl@0
|
300 |
}
|
sl@0
|
301 |
return err;
|
sl@0
|
302 |
}
|
sl@0
|
303 |
|
sl@0
|
304 |
|
sl@0
|
305 |
/**
|
sl@0
|
306 |
* Common code for calling Create()
|
sl@0
|
307 |
*
|
sl@0
|
308 |
* @param aValType enum indicating which data type to test
|
sl@0
|
309 |
* (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will return KErrArgument).
|
sl@0
|
310 |
* @return err code from Create()
|
sl@0
|
311 |
*/
|
sl@0
|
312 |
TInt CreateNewSetting(TValType aValType)
|
sl@0
|
313 |
{
|
sl@0
|
314 |
TInt err(KErrNone);
|
sl@0
|
315 |
|
sl@0
|
316 |
switch (aValType)
|
sl@0
|
317 |
{
|
sl@0
|
318 |
case EIntVal:
|
sl@0
|
319 |
err = TheRepository->Create(KNewIntKey, KNewIntVal);
|
sl@0
|
320 |
break;
|
sl@0
|
321 |
|
sl@0
|
322 |
case ERealVal:
|
sl@0
|
323 |
err = TheRepository->Create(KNewRealKey, KNewRealVal);
|
sl@0
|
324 |
break;
|
sl@0
|
325 |
|
sl@0
|
326 |
case EBinaryVal:
|
sl@0
|
327 |
err = TheRepository->Create(KNewBinKey, KNewBinVal);
|
sl@0
|
328 |
break;
|
sl@0
|
329 |
|
sl@0
|
330 |
case EStringVal:
|
sl@0
|
331 |
err = TheRepository->Create(KNewStrKey, KNewStrVal);
|
sl@0
|
332 |
break;
|
sl@0
|
333 |
|
sl@0
|
334 |
case EMetaVal:
|
sl@0
|
335 |
// no meta testing on new setting so fall through
|
sl@0
|
336 |
|
sl@0
|
337 |
default:
|
sl@0
|
338 |
err = KErrArgument;
|
sl@0
|
339 |
break;
|
sl@0
|
340 |
}
|
sl@0
|
341 |
return err;
|
sl@0
|
342 |
}
|
sl@0
|
343 |
|
sl@0
|
344 |
|
sl@0
|
345 |
/**
|
sl@0
|
346 |
* Common code for calling Reset()
|
sl@0
|
347 |
*
|
sl@0
|
348 |
* @param aValType enum indicating which data type to test
|
sl@0
|
349 |
* (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will return KErrArgument).
|
sl@0
|
350 |
* @return err code from Reset()
|
sl@0
|
351 |
*/
|
sl@0
|
352 |
TInt ResetSetting(TValType aValType)
|
sl@0
|
353 |
{
|
sl@0
|
354 |
TInt err(KErrNone);
|
sl@0
|
355 |
|
sl@0
|
356 |
switch (aValType)
|
sl@0
|
357 |
{
|
sl@0
|
358 |
case EIntVal:
|
sl@0
|
359 |
err = TheRepository->Reset(KIntKey);
|
sl@0
|
360 |
break;
|
sl@0
|
361 |
|
sl@0
|
362 |
case ERealVal:
|
sl@0
|
363 |
err = TheRepository->Reset(KRealKey);
|
sl@0
|
364 |
break;
|
sl@0
|
365 |
|
sl@0
|
366 |
case EBinaryVal:
|
sl@0
|
367 |
err = TheRepository->Reset(KBinKey);
|
sl@0
|
368 |
break;
|
sl@0
|
369 |
|
sl@0
|
370 |
case EStringVal:
|
sl@0
|
371 |
err = TheRepository->Reset(KStrKey);
|
sl@0
|
372 |
break;
|
sl@0
|
373 |
|
sl@0
|
374 |
case EMetaVal:
|
sl@0
|
375 |
// no meta testing on new setting so fall through
|
sl@0
|
376 |
|
sl@0
|
377 |
default:
|
sl@0
|
378 |
err = KErrArgument;
|
sl@0
|
379 |
break;
|
sl@0
|
380 |
}
|
sl@0
|
381 |
return err;
|
sl@0
|
382 |
}
|
sl@0
|
383 |
|
sl@0
|
384 |
|
sl@0
|
385 |
/**
|
sl@0
|
386 |
* Common code for calling FindL()
|
sl@0
|
387 |
*
|
sl@0
|
388 |
* @param aStart Out parameter for start timer value
|
sl@0
|
389 |
* @param aEnd Out parameter for end timer value
|
sl@0
|
390 |
* @param aFound Out parameter for number of settings found
|
sl@0
|
391 |
* @return err code from FindL()
|
sl@0
|
392 |
*/
|
sl@0
|
393 |
TInt FindRangeL(TInt& aStart, TInt& aEnd, TInt& aFound)
|
sl@0
|
394 |
{
|
sl@0
|
395 |
RArray<TUint32> keys;
|
sl@0
|
396 |
CleanupClosePushL(keys);
|
sl@0
|
397 |
|
sl@0
|
398 |
aStart = User::FastCounter();
|
sl@0
|
399 |
TInt err = TheRepository->FindL(KFindPartialKey, KFindMask, keys);
|
sl@0
|
400 |
aEnd = User::FastCounter();
|
sl@0
|
401 |
|
sl@0
|
402 |
aFound = keys.Count();
|
sl@0
|
403 |
|
sl@0
|
404 |
CleanupStack::PopAndDestroy(&keys);
|
sl@0
|
405 |
|
sl@0
|
406 |
return err;
|
sl@0
|
407 |
}
|
sl@0
|
408 |
|
sl@0
|
409 |
|
sl@0
|
410 |
/**
|
sl@0
|
411 |
* Common code for performing all the Get() tests
|
sl@0
|
412 |
*
|
sl@0
|
413 |
* @param aValType enum indicating which data type to test
|
sl@0
|
414 |
* (EIntVal, ERealVal, EBinaryVal, EStringVal or EMetaVal -- any other value will fail with KErrArgument).
|
sl@0
|
415 |
* @param aUseTransaction bool instructing whether to use a read-mode transaction or not
|
sl@0
|
416 |
*/
|
sl@0
|
417 |
void DoGetTest(TValType aValType, TBool aUseTransaction = EFalse)
|
sl@0
|
418 |
{
|
sl@0
|
419 |
TInt err(KErrNone);
|
sl@0
|
420 |
TInt result(EFalse);
|
sl@0
|
421 |
TUint32 keyInfo(0);
|
sl@0
|
422 |
|
sl@0
|
423 |
TUint32 start = User::FastCounter();
|
sl@0
|
424 |
|
sl@0
|
425 |
// start transaction, if required
|
sl@0
|
426 |
err = aUseTransaction ? TheRepository->StartTransaction(CRepository::EReadTransaction) : err;
|
sl@0
|
427 |
TEST2(err, KErrNone);
|
sl@0
|
428 |
|
sl@0
|
429 |
err = GetOldVal(aValType, result);
|
sl@0
|
430 |
TEST2(err, KErrNone);
|
sl@0
|
431 |
|
sl@0
|
432 |
// end transaction, if required
|
sl@0
|
433 |
err = aUseTransaction ? TheRepository->CommitTransaction(keyInfo) : err;
|
sl@0
|
434 |
TEST2(err, KErrNone);
|
sl@0
|
435 |
|
sl@0
|
436 |
TUint32 end = User::FastCounter();
|
sl@0
|
437 |
|
sl@0
|
438 |
TEST(result);
|
sl@0
|
439 |
|
sl@0
|
440 |
PrintStats(start, end);
|
sl@0
|
441 |
}
|
sl@0
|
442 |
|
sl@0
|
443 |
|
sl@0
|
444 |
/**
|
sl@0
|
445 |
* Common code for performing the Set() and Reset() tests for all datatypes
|
sl@0
|
446 |
*
|
sl@0
|
447 |
* @param aValType enum indicating which data type to test
|
sl@0
|
448 |
* (EIntVal, ERealVal, EBinaryVal or EStringVal -- any other value will fail with KErrArgument).
|
sl@0
|
449 |
* @param aTestType enum defining whether Set() or Reset() should be timed
|
sl@0
|
450 |
*/
|
sl@0
|
451 |
void DoSetResetTest(TValType aValType, TTestType aTestType)
|
sl@0
|
452 |
{
|
sl@0
|
453 |
TInt err(KErrNone);
|
sl@0
|
454 |
TInt result(EFalse);
|
sl@0
|
455 |
|
sl@0
|
456 |
// Check we get the old expected value
|
sl@0
|
457 |
err = GetOldVal(aValType, result);
|
sl@0
|
458 |
TEST2(err, KErrNone);
|
sl@0
|
459 |
TEST(result);
|
sl@0
|
460 |
|
sl@0
|
461 |
TUint32 start(0);
|
sl@0
|
462 |
TUint32 end(0);
|
sl@0
|
463 |
|
sl@0
|
464 |
// Set the new value
|
sl@0
|
465 |
start = aTestType == ESetTest ? User::FastCounter() : start;
|
sl@0
|
466 |
err = SetNewVal(aValType);
|
sl@0
|
467 |
end = aTestType == ESetTest ? User::FastCounter() : end;
|
sl@0
|
468 |
TEST2(err, KErrNone);
|
sl@0
|
469 |
|
sl@0
|
470 |
// Test we get the new value to check it's worked
|
sl@0
|
471 |
err = GetNewVal(aValType, ESetTest, result);
|
sl@0
|
472 |
TEST2(err, KErrNone);
|
sl@0
|
473 |
TEST(result);
|
sl@0
|
474 |
|
sl@0
|
475 |
// Restore the old value
|
sl@0
|
476 |
start = aTestType == EResetTest ? User::FastCounter() : start;
|
sl@0
|
477 |
err = ResetSetting(aValType);
|
sl@0
|
478 |
end = aTestType == EResetTest ? User::FastCounter() : end;
|
sl@0
|
479 |
TEST2(err, KErrNone);
|
sl@0
|
480 |
|
sl@0
|
481 |
// Check reset's worked
|
sl@0
|
482 |
err = GetOldVal(aValType, result);
|
sl@0
|
483 |
TEST2(err, KErrNone);
|
sl@0
|
484 |
TEST(result);
|
sl@0
|
485 |
|
sl@0
|
486 |
PrintStats(start, end);
|
sl@0
|
487 |
}
|
sl@0
|
488 |
|
sl@0
|
489 |
|
sl@0
|
490 |
/**
|
sl@0
|
491 |
* Common code for performing all the Create() tests
|
sl@0
|
492 |
*
|
sl@0
|
493 |
* @param aValType enum indicating which data type to test
|
sl@0
|
494 |
* (EIntVal, ERealVal, EBinaryVal, EStringVal, EMetaVal -- any other value will fail with KErrArgument).
|
sl@0
|
495 |
*/
|
sl@0
|
496 |
void DoCreateTest(TValType aValType)
|
sl@0
|
497 |
{
|
sl@0
|
498 |
TInt err(KErrNone);
|
sl@0
|
499 |
TInt result(EFalse);
|
sl@0
|
500 |
|
sl@0
|
501 |
TUint32 start(0);
|
sl@0
|
502 |
TUint32 end(0);
|
sl@0
|
503 |
|
sl@0
|
504 |
// Create the new setting
|
sl@0
|
505 |
start = User::FastCounter();
|
sl@0
|
506 |
err = CreateNewSetting(aValType);
|
sl@0
|
507 |
end = User::FastCounter();
|
sl@0
|
508 |
TEST2(err, KErrNone);
|
sl@0
|
509 |
|
sl@0
|
510 |
// Test we get the right value from the new setting to check it's worked
|
sl@0
|
511 |
err = GetNewVal(aValType, ECreateTest, result);
|
sl@0
|
512 |
TEST2(err, KErrNone);
|
sl@0
|
513 |
TEST(result);
|
sl@0
|
514 |
|
sl@0
|
515 |
PrintStats(start, end);
|
sl@0
|
516 |
}
|
sl@0
|
517 |
|
sl@0
|
518 |
|
sl@0
|
519 |
/**
|
sl@0
|
520 |
* Common code for performing all the FindEqL() and FindNeqL() tests
|
sl@0
|
521 |
*
|
sl@0
|
522 |
* @param aValType enum indicating which data type to test
|
sl@0
|
523 |
* (EIntVal, ERealVal, EBinaryVal, EStringVal, EMetaVal -- any other value will fail with KErrArgument).
|
sl@0
|
524 |
* @param aTestType enum defining whether FindEqL() or FindNeqL() should be timed
|
sl@0
|
525 |
* (EFindEqTest or EFindNeqTest -- anything else will leave with KErrArgument).
|
sl@0
|
526 |
*/
|
sl@0
|
527 |
void DoFindEqNeqTestL(TValType aValType, TTestType aTestType)
|
sl@0
|
528 |
{
|
sl@0
|
529 |
const TUint32 KPartialKey(0x8D800000);
|
sl@0
|
530 |
const TUint32 KMask(0xFFF00000);
|
sl@0
|
531 |
const TInt KFindNum(1);
|
sl@0
|
532 |
const TInt KNotFindNum(15);
|
sl@0
|
533 |
|
sl@0
|
534 |
const TInt KIntFindVal(9999);
|
sl@0
|
535 |
const TReal KRealFindVal(999.9);
|
sl@0
|
536 |
_LIT8(KBinFindVal, "\xab\xcd\x99\x99");
|
sl@0
|
537 |
_LIT(KStrFindVal, "abcd9999");
|
sl@0
|
538 |
|
sl@0
|
539 |
RArray<TUint32> results;
|
sl@0
|
540 |
CleanupClosePushL(results);
|
sl@0
|
541 |
|
sl@0
|
542 |
TInt expectedCount(0);
|
sl@0
|
543 |
switch(aTestType)
|
sl@0
|
544 |
{
|
sl@0
|
545 |
case EFindEqTest:
|
sl@0
|
546 |
expectedCount = KFindNum;
|
sl@0
|
547 |
break;
|
sl@0
|
548 |
|
sl@0
|
549 |
case EFindNeqTest:
|
sl@0
|
550 |
expectedCount = KNotFindNum;
|
sl@0
|
551 |
break;
|
sl@0
|
552 |
|
sl@0
|
553 |
default:
|
sl@0
|
554 |
// wrong test type passed in
|
sl@0
|
555 |
User::Leave(KErrArgument);
|
sl@0
|
556 |
}
|
sl@0
|
557 |
|
sl@0
|
558 |
TInt err(KErrNone);
|
sl@0
|
559 |
|
sl@0
|
560 |
TUint32 start = User::FastCounter();
|
sl@0
|
561 |
switch (aValType)
|
sl@0
|
562 |
{
|
sl@0
|
563 |
case EIntVal:
|
sl@0
|
564 |
err = (aTestType == EFindEqTest) ?
|
sl@0
|
565 |
TheRepository->FindEqL(KPartialKey, KMask, KIntFindVal, results) :
|
sl@0
|
566 |
TheRepository->FindNeqL(KPartialKey, KMask, KIntFindVal, results);
|
sl@0
|
567 |
break;
|
sl@0
|
568 |
|
sl@0
|
569 |
case ERealVal:
|
sl@0
|
570 |
err = (aTestType == EFindEqTest) ?
|
sl@0
|
571 |
TheRepository->FindEqL(KPartialKey, KMask, KRealFindVal, results) :
|
sl@0
|
572 |
TheRepository->FindNeqL(KPartialKey, KMask, KRealFindVal, results);
|
sl@0
|
573 |
break;
|
sl@0
|
574 |
|
sl@0
|
575 |
case EBinaryVal:
|
sl@0
|
576 |
err = (aTestType == EFindEqTest) ?
|
sl@0
|
577 |
TheRepository->FindEqL(KPartialKey, KMask, KBinFindVal, results) :
|
sl@0
|
578 |
TheRepository->FindNeqL(KPartialKey, KMask, KBinFindVal, results);
|
sl@0
|
579 |
break;
|
sl@0
|
580 |
|
sl@0
|
581 |
case EStringVal:
|
sl@0
|
582 |
err = (aTestType == EFindEqTest) ?
|
sl@0
|
583 |
TheRepository->FindEqL(KPartialKey, KMask, KStrFindVal, results) :
|
sl@0
|
584 |
TheRepository->FindNeqL(KPartialKey, KMask, KStrFindVal, results);
|
sl@0
|
585 |
break;
|
sl@0
|
586 |
|
sl@0
|
587 |
case EMetaVal:
|
sl@0
|
588 |
// no meta testing on new setting so fall through
|
sl@0
|
589 |
|
sl@0
|
590 |
default:
|
sl@0
|
591 |
err = KErrArgument;
|
sl@0
|
592 |
break;
|
sl@0
|
593 |
}
|
sl@0
|
594 |
TUint32 end = User::FastCounter();
|
sl@0
|
595 |
|
sl@0
|
596 |
// Test there was no error and that we found the expected number
|
sl@0
|
597 |
TEST2(err, KErrNone);
|
sl@0
|
598 |
TEST(results.Count() == expectedCount);
|
sl@0
|
599 |
|
sl@0
|
600 |
CleanupStack::PopAndDestroy(&results);
|
sl@0
|
601 |
|
sl@0
|
602 |
PrintStats(start, end);
|
sl@0
|
603 |
}
|
sl@0
|
604 |
|
sl@0
|
605 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
606 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
607 |
|
sl@0
|
608 |
// TEST CASES
|
sl@0
|
609 |
|
sl@0
|
610 |
/**
|
sl@0
|
611 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-UT-4047
|
sl@0
|
612 |
@SYMTestCaseDesc CRepository::Get(TUint32 aKey, TInt& aValue) - performance test
|
sl@0
|
613 |
The test measures the time needed for retrieving of a single integer setting.
|
sl@0
|
614 |
@SYMTestPriority High
|
sl@0
|
615 |
@SYMTestActions CRepository::Get(TUint32 aKey, TInt& aValue) - performance test
|
sl@0
|
616 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
617 |
@SYMDEF DEF128986
|
sl@0
|
618 |
*/
|
sl@0
|
619 |
void GetIntTest()
|
sl@0
|
620 |
{
|
sl@0
|
621 |
DoGetTest(EIntVal);
|
sl@0
|
622 |
}
|
sl@0
|
623 |
|
sl@0
|
624 |
|
sl@0
|
625 |
/**
|
sl@0
|
626 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4087
|
sl@0
|
627 |
@SYMTestCaseDesc CRepository::Get(TUint32 aKey, TReal& aValue) - performance test
|
sl@0
|
628 |
The test measures the time needed for retrieving of a single real setting,
|
sl@0
|
629 |
witht the Get() wrapped in a read-mode transaction.
|
sl@0
|
630 |
@SYMTestPriority High
|
sl@0
|
631 |
@SYMTestActions CRepository::Get(TUint32 aKey, TReal& aValue)
|
sl@0
|
632 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
633 |
@SYMPREQ PREQ2505
|
sl@0
|
634 |
@SYMREQ REQ13142
|
sl@0
|
635 |
*/
|
sl@0
|
636 |
void GetRealTest()
|
sl@0
|
637 |
{
|
sl@0
|
638 |
DoGetTest(ERealVal, ETrue);
|
sl@0
|
639 |
}
|
sl@0
|
640 |
|
sl@0
|
641 |
|
sl@0
|
642 |
/**
|
sl@0
|
643 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-UT-4048
|
sl@0
|
644 |
@SYMTestCaseDesc CRepository::Get(TUint32 aKey, TDes8& aValue) - performance test
|
sl@0
|
645 |
The test measures the time needed for retrieving of a single 8-bit string setting.
|
sl@0
|
646 |
@SYMTestPriority High
|
sl@0
|
647 |
@SYMTestActions CRepository::Get(TUint32 aKey, TDes8& aValue) - performance test
|
sl@0
|
648 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
649 |
@SYMDEF DEF128986
|
sl@0
|
650 |
*/
|
sl@0
|
651 |
void GetBinaryTest()
|
sl@0
|
652 |
{
|
sl@0
|
653 |
DoGetTest(EBinaryVal);
|
sl@0
|
654 |
}
|
sl@0
|
655 |
|
sl@0
|
656 |
|
sl@0
|
657 |
/**
|
sl@0
|
658 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4088
|
sl@0
|
659 |
@SYMTestCaseDesc CRepository::Get(TUint32 aKey, TDes8& aValue) - performance test
|
sl@0
|
660 |
The test measures the time needed for retrieving of a single 8-bit string setting,
|
sl@0
|
661 |
with the Get() wrapped in a read-mode transaction.
|
sl@0
|
662 |
@SYMTestPriority High
|
sl@0
|
663 |
@SYMTestActions CRepository::Get(TUint32 aKey, TDes8& aValue)
|
sl@0
|
664 |
CRepository::StartTransaction(TTransactionMode aMode)
|
sl@0
|
665 |
CRepository::CommitTransaction(TUint32 &aKeyInfo)
|
sl@0
|
666 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
667 |
@SYMPREQ PREQ2505
|
sl@0
|
668 |
@SYMREQ REQ13142
|
sl@0
|
669 |
*/
|
sl@0
|
670 |
void GetBinaryInTransactionTest()
|
sl@0
|
671 |
{
|
sl@0
|
672 |
DoGetTest(EBinaryVal, ETrue);
|
sl@0
|
673 |
}
|
sl@0
|
674 |
|
sl@0
|
675 |
|
sl@0
|
676 |
/**
|
sl@0
|
677 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4089
|
sl@0
|
678 |
@SYMTestCaseDesc CRepository::Get(TUint32 aKey, TDesC16& aValue) - performance test
|
sl@0
|
679 |
The test measures the time needed for retrieving of a single 16-bit string setting.
|
sl@0
|
680 |
@SYMTestPriority High
|
sl@0
|
681 |
@SYMTestActions CRepository::Get(TUint32 aKey, TDesC16& aValue)
|
sl@0
|
682 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
683 |
@SYMPREQ PREQ2505
|
sl@0
|
684 |
@SYMREQ REQ13142
|
sl@0
|
685 |
*/
|
sl@0
|
686 |
void GetStringTest()
|
sl@0
|
687 |
{
|
sl@0
|
688 |
DoGetTest(EStringVal, ETrue);
|
sl@0
|
689 |
}
|
sl@0
|
690 |
|
sl@0
|
691 |
|
sl@0
|
692 |
/**
|
sl@0
|
693 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4090
|
sl@0
|
694 |
@SYMTestCaseDesc CRepository::GetMeta(TUint32 aKey, TUint32& aMeta) - performance test
|
sl@0
|
695 |
The test measures the time needed for retrieving metadata for a single setting.
|
sl@0
|
696 |
@SYMTestPriority High
|
sl@0
|
697 |
@SYMTestActions CRepository::GetMeta(TUint32 aKey, TUint32& aMeta)
|
sl@0
|
698 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
699 |
@SYMPREQ PREQ2505
|
sl@0
|
700 |
@SYMREQ REQ13142
|
sl@0
|
701 |
*/
|
sl@0
|
702 |
void GetMetaTest()
|
sl@0
|
703 |
{
|
sl@0
|
704 |
DoGetTest(EMetaVal, ETrue);
|
sl@0
|
705 |
}
|
sl@0
|
706 |
|
sl@0
|
707 |
|
sl@0
|
708 |
/**
|
sl@0
|
709 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4091
|
sl@0
|
710 |
@SYMTestCaseDesc CRepository::Set(TUint32 aKey, TInt aValue) - performance test
|
sl@0
|
711 |
The test measures the time needed for setting a single integer setting.
|
sl@0
|
712 |
@SYMTestPriority High
|
sl@0
|
713 |
@SYMTestActions CRepository::Set(TUint32 aKey, TInt aValue)
|
sl@0
|
714 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
715 |
@SYMPREQ PREQ2505
|
sl@0
|
716 |
@SYMREQ REQ13142
|
sl@0
|
717 |
*/
|
sl@0
|
718 |
void SetIntTest()
|
sl@0
|
719 |
{
|
sl@0
|
720 |
DoSetResetTest(EIntVal, ESetTest);
|
sl@0
|
721 |
}
|
sl@0
|
722 |
|
sl@0
|
723 |
|
sl@0
|
724 |
/**
|
sl@0
|
725 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4092
|
sl@0
|
726 |
@SYMTestCaseDesc CRepository::Set(TUint32 aKey, TReal aValue) - performance test
|
sl@0
|
727 |
The test measures the time needed for setting a single real setting.
|
sl@0
|
728 |
@SYMTestPriority High
|
sl@0
|
729 |
@SYMTestActions CRepository::Set(TUint32 aKey, TReal aValue)
|
sl@0
|
730 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
731 |
@SYMPREQ PREQ2505
|
sl@0
|
732 |
@SYMREQ REQ13142
|
sl@0
|
733 |
*/
|
sl@0
|
734 |
void SetRealTest()
|
sl@0
|
735 |
{
|
sl@0
|
736 |
DoSetResetTest(ERealVal, ESetTest);
|
sl@0
|
737 |
}
|
sl@0
|
738 |
|
sl@0
|
739 |
|
sl@0
|
740 |
/**
|
sl@0
|
741 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4093
|
sl@0
|
742 |
@SYMTestCaseDesc CRepository::Set(TUint32 aKey, TDes8& aValue) - performance test
|
sl@0
|
743 |
The test measures the time needed for setting a single 8-bit string setting.
|
sl@0
|
744 |
@SYMTestPriority High
|
sl@0
|
745 |
@SYMTestActions CRepository::Set(TUint32 aKey, TDes8& aValue)
|
sl@0
|
746 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
747 |
@SYMPREQ PREQ2505
|
sl@0
|
748 |
@SYMREQ REQ13142
|
sl@0
|
749 |
*/
|
sl@0
|
750 |
void SetBinaryTest()
|
sl@0
|
751 |
{
|
sl@0
|
752 |
DoSetResetTest(EBinaryVal, ESetTest);
|
sl@0
|
753 |
}
|
sl@0
|
754 |
|
sl@0
|
755 |
|
sl@0
|
756 |
/**
|
sl@0
|
757 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4094
|
sl@0
|
758 |
@SYMTestCaseDesc CRepository::Set(TUint32 aKey, TDesC16& aValue) - performance test
|
sl@0
|
759 |
The test measures the time needed for setting a single 16-bit string setting.
|
sl@0
|
760 |
@SYMTestPriority High
|
sl@0
|
761 |
@SYMTestActions CRepository::Set(TUint32 aKey, TDesC16& aValue)
|
sl@0
|
762 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
763 |
@SYMPREQ PREQ2505
|
sl@0
|
764 |
@SYMREQ REQ13142
|
sl@0
|
765 |
*/
|
sl@0
|
766 |
void SetStringTest()
|
sl@0
|
767 |
{
|
sl@0
|
768 |
DoSetResetTest(EStringVal, ESetTest);
|
sl@0
|
769 |
}
|
sl@0
|
770 |
|
sl@0
|
771 |
|
sl@0
|
772 |
/**
|
sl@0
|
773 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4095
|
sl@0
|
774 |
@SYMTestCaseDesc CRepository::Create(TUint32 aKey, TInt aValue) - performance test
|
sl@0
|
775 |
The test measures the time needed for creating a new single integer setting.
|
sl@0
|
776 |
@SYMTestPriority High
|
sl@0
|
777 |
@SYMTestActions CRepository::Create(TUint32 aKey, TInt aValue)
|
sl@0
|
778 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
779 |
@SYMPREQ PREQ2505
|
sl@0
|
780 |
@SYMREQ REQ13142
|
sl@0
|
781 |
*/
|
sl@0
|
782 |
void CreateIntTest()
|
sl@0
|
783 |
{
|
sl@0
|
784 |
DoCreateTest(EIntVal);
|
sl@0
|
785 |
}
|
sl@0
|
786 |
|
sl@0
|
787 |
|
sl@0
|
788 |
/**
|
sl@0
|
789 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4096
|
sl@0
|
790 |
@SYMTestCaseDesc CRepository::Create(TUint32 aKey, TReal aValue) - performance test
|
sl@0
|
791 |
The test measures the time needed for creating a new single real setting.
|
sl@0
|
792 |
@SYMTestPriority High
|
sl@0
|
793 |
@SYMTestActions CRepository::Create(TUint32 aKey, TReal aValue)
|
sl@0
|
794 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
795 |
@SYMPREQ PREQ2505
|
sl@0
|
796 |
@SYMREQ REQ13142
|
sl@0
|
797 |
*/
|
sl@0
|
798 |
void CreateRealTest()
|
sl@0
|
799 |
{
|
sl@0
|
800 |
DoCreateTest(ERealVal);
|
sl@0
|
801 |
}
|
sl@0
|
802 |
|
sl@0
|
803 |
|
sl@0
|
804 |
/**
|
sl@0
|
805 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4097
|
sl@0
|
806 |
@SYMTestCaseDesc CRepository::Create(TUint32 aKey, TDesC8& aValue) - performance test
|
sl@0
|
807 |
The test measures the time needed for creating a new single 8-bit string setting.
|
sl@0
|
808 |
@SYMTestPriority High
|
sl@0
|
809 |
@SYMTestActions CRepository::Create(TUint32 aKey, TDesC8& aValue)
|
sl@0
|
810 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
811 |
@SYMPREQ PREQ2505
|
sl@0
|
812 |
@SYMREQ REQ13142
|
sl@0
|
813 |
*/
|
sl@0
|
814 |
void CreateBinaryTest()
|
sl@0
|
815 |
{
|
sl@0
|
816 |
DoCreateTest(EBinaryVal);
|
sl@0
|
817 |
}
|
sl@0
|
818 |
|
sl@0
|
819 |
|
sl@0
|
820 |
/**
|
sl@0
|
821 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4098
|
sl@0
|
822 |
@SYMTestCaseDesc CRepository::Create(TUint32 aKey, TDesC16& aValue) - performance test
|
sl@0
|
823 |
The test measures the time needed for creating a new single 16-bit string setting.
|
sl@0
|
824 |
@SYMTestPriority High
|
sl@0
|
825 |
@SYMTestActions CRepository::Create(TUint32 aKey, TDesC16& aValue)
|
sl@0
|
826 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
827 |
@SYMPREQ PREQ2505
|
sl@0
|
828 |
@SYMREQ REQ13142
|
sl@0
|
829 |
*/
|
sl@0
|
830 |
void CreateStringTest()
|
sl@0
|
831 |
{
|
sl@0
|
832 |
DoCreateTest(EStringVal);
|
sl@0
|
833 |
}
|
sl@0
|
834 |
|
sl@0
|
835 |
|
sl@0
|
836 |
/**
|
sl@0
|
837 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-UT-4049
|
sl@0
|
838 |
@SYMTestCaseDesc CRepository::FindL(TUint32 aPartialKey, TUint32 aMask, RArray<TUint32>& aFoundKeys) - performance test
|
sl@0
|
839 |
The test measures the time needed for retrieving of an array of keys matching the function arguments.
|
sl@0
|
840 |
@SYMTestPriority High
|
sl@0
|
841 |
@SYMTestActions CRepository::FindL(TUint32 aPartialKey, TUint32 aMask, RArray<TUint32>& aFoundKeys)
|
sl@0
|
842 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
843 |
@SYMDEF DEF128986
|
sl@0
|
844 |
*/
|
sl@0
|
845 |
void FindTestL()
|
sl@0
|
846 |
{
|
sl@0
|
847 |
TInt start(0);
|
sl@0
|
848 |
TInt end(0);
|
sl@0
|
849 |
TInt found(0);
|
sl@0
|
850 |
|
sl@0
|
851 |
TInt err = FindRangeL(start, end, found);
|
sl@0
|
852 |
|
sl@0
|
853 |
TEST2(err, KErrNone);
|
sl@0
|
854 |
TEST2(found, KFindKeyCount);
|
sl@0
|
855 |
|
sl@0
|
856 |
PrintStats(start, end);
|
sl@0
|
857 |
}
|
sl@0
|
858 |
|
sl@0
|
859 |
|
sl@0
|
860 |
/**
|
sl@0
|
861 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4099
|
sl@0
|
862 |
@SYMTestCaseDesc CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TInt aValue, RArray< TUint32 > &aFoundKeys) - performance test
|
sl@0
|
863 |
The test measures the time to find an int setting in an "equals" search on a range.
|
sl@0
|
864 |
@SYMTestPriority High
|
sl@0
|
865 |
@SYMTestActions CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TInt aValue, RArray< TUint32 > &aFoundKeys)
|
sl@0
|
866 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
867 |
@SYMPREQ PREQ2505
|
sl@0
|
868 |
@SYMREQ REQ13142
|
sl@0
|
869 |
*/
|
sl@0
|
870 |
void FindEqIntTestL()
|
sl@0
|
871 |
{
|
sl@0
|
872 |
DoFindEqNeqTestL(EIntVal, EFindEqTest);
|
sl@0
|
873 |
}
|
sl@0
|
874 |
|
sl@0
|
875 |
|
sl@0
|
876 |
/**
|
sl@0
|
877 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4100
|
sl@0
|
878 |
@SYMTestCaseDesc CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TReal aValue, RArray< TUint32 > &aFoundKeys) - performance test
|
sl@0
|
879 |
The test measures the time to find a real setting in an "equals" search on a range.
|
sl@0
|
880 |
@SYMTestPriority High
|
sl@0
|
881 |
@SYMTestActions CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TReal aValue, RArray< TUint32 > &aFoundKeys)
|
sl@0
|
882 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
883 |
@SYMPREQ PREQ2505
|
sl@0
|
884 |
@SYMREQ REQ13142
|
sl@0
|
885 |
*/
|
sl@0
|
886 |
void FindEqRealTestL()
|
sl@0
|
887 |
{
|
sl@0
|
888 |
DoFindEqNeqTestL(ERealVal, EFindEqTest);
|
sl@0
|
889 |
}
|
sl@0
|
890 |
|
sl@0
|
891 |
|
sl@0
|
892 |
/**
|
sl@0
|
893 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4101
|
sl@0
|
894 |
@SYMTestCaseDesc CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TDesC8& aValue, RArray< TUint32 > &aFoundKeys) - performance test
|
sl@0
|
895 |
The test measures the time to find an 8-bit string setting in an "equals" search on a range.
|
sl@0
|
896 |
@SYMTestPriority High
|
sl@0
|
897 |
@SYMTestActions CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TDesC8& aValue, RArray< TUint32 > &aFoundKeys)
|
sl@0
|
898 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
899 |
@SYMPREQ PREQ2505
|
sl@0
|
900 |
@SYMREQ REQ13142
|
sl@0
|
901 |
*/
|
sl@0
|
902 |
void FindEqBinaryTestL()
|
sl@0
|
903 |
{
|
sl@0
|
904 |
DoFindEqNeqTestL(EBinaryVal, EFindEqTest);
|
sl@0
|
905 |
}
|
sl@0
|
906 |
|
sl@0
|
907 |
|
sl@0
|
908 |
/**
|
sl@0
|
909 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4102
|
sl@0
|
910 |
@SYMTestCaseDesc CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TDesC16& aValue, RArray< TUint32 > &aFoundKeys) - performance test
|
sl@0
|
911 |
The test measures the time to find an 16-bit string setting in an "equals" search on a range.
|
sl@0
|
912 |
@SYMTestPriority High
|
sl@0
|
913 |
@SYMTestActions CRepository::FindEqL(TUint32 aPartialKey, TUint32 aMask, TDesC16& aValue, RArray< TUint32 > &aFoundKeys)
|
sl@0
|
914 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
915 |
@SYMPREQ PREQ2505
|
sl@0
|
916 |
@SYMREQ REQ13142
|
sl@0
|
917 |
*/
|
sl@0
|
918 |
void FindEqStringTestL()
|
sl@0
|
919 |
{
|
sl@0
|
920 |
DoFindEqNeqTestL(EStringVal, EFindEqTest);
|
sl@0
|
921 |
}
|
sl@0
|
922 |
|
sl@0
|
923 |
|
sl@0
|
924 |
/**
|
sl@0
|
925 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4103
|
sl@0
|
926 |
@SYMTestCaseDesc CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TInt aValue, RArray< TUint32 > &aFoundKeys) - performance test
|
sl@0
|
927 |
The test measures the time to find an int setting in an "not equals" search on a range.
|
sl@0
|
928 |
@SYMTestPriority High
|
sl@0
|
929 |
@SYMTestActions CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TInt aValue, RArray< TUint32 > &aFoundKeys)
|
sl@0
|
930 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
931 |
@SYMPREQ PREQ2505
|
sl@0
|
932 |
@SYMREQ REQ13142
|
sl@0
|
933 |
*/
|
sl@0
|
934 |
void FindNeqIntTestL()
|
sl@0
|
935 |
{
|
sl@0
|
936 |
DoFindEqNeqTestL(EIntVal, EFindNeqTest);
|
sl@0
|
937 |
}
|
sl@0
|
938 |
|
sl@0
|
939 |
|
sl@0
|
940 |
/**
|
sl@0
|
941 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4104
|
sl@0
|
942 |
@SYMTestCaseDesc CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TReal aValue, RArray< TUint32 > &aFoundKeys) - performance test
|
sl@0
|
943 |
The test measures the time to find a real setting in an "not equals" search on a range.
|
sl@0
|
944 |
@SYMTestPriority High
|
sl@0
|
945 |
@SYMTestActions CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TReal aValue, RArray< TUint32 > &aFoundKeys)
|
sl@0
|
946 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
947 |
@SYMPREQ PREQ2505
|
sl@0
|
948 |
@SYMREQ REQ13142
|
sl@0
|
949 |
*/
|
sl@0
|
950 |
void FindNeqRealTestL()
|
sl@0
|
951 |
{
|
sl@0
|
952 |
DoFindEqNeqTestL(ERealVal, EFindNeqTest);
|
sl@0
|
953 |
}
|
sl@0
|
954 |
|
sl@0
|
955 |
|
sl@0
|
956 |
/**
|
sl@0
|
957 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4105
|
sl@0
|
958 |
@SYMTestCaseDesc CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TDesC8& aValue, RArray< TUint32 > &aFoundKeys) - performance test
|
sl@0
|
959 |
The test measures the time to find an 8-bit string setting in an "not equals" search on a range.
|
sl@0
|
960 |
@SYMTestPriority High
|
sl@0
|
961 |
@SYMTestActions CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TDesC8& aValue, RArray< TUint32 > &aFoundKeys)
|
sl@0
|
962 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
963 |
@SYMPREQ PREQ2505
|
sl@0
|
964 |
@SYMREQ REQ13142
|
sl@0
|
965 |
*/
|
sl@0
|
966 |
void FindNeqBinaryTestL()
|
sl@0
|
967 |
{
|
sl@0
|
968 |
DoFindEqNeqTestL(EBinaryVal, EFindNeqTest);
|
sl@0
|
969 |
}
|
sl@0
|
970 |
|
sl@0
|
971 |
|
sl@0
|
972 |
/**
|
sl@0
|
973 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4106
|
sl@0
|
974 |
@SYMTestCaseDesc CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TDesC16& aValue, RArray< TUint32 > &aFoundKeys) - performance test
|
sl@0
|
975 |
The test measures the time to find an 16-bit string setting in an "not equals" search on a range.
|
sl@0
|
976 |
@SYMTestPriority High
|
sl@0
|
977 |
@SYMTestActions CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask, TDesC16& aValue, RArray< TUint32 > &aFoundKeys)
|
sl@0
|
978 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
979 |
@SYMPREQ PREQ2505
|
sl@0
|
980 |
@SYMREQ REQ13142
|
sl@0
|
981 |
*/
|
sl@0
|
982 |
void FindNeqStringTestL()
|
sl@0
|
983 |
{
|
sl@0
|
984 |
DoFindEqNeqTestL(EStringVal, EFindNeqTest);
|
sl@0
|
985 |
}
|
sl@0
|
986 |
|
sl@0
|
987 |
|
sl@0
|
988 |
/**
|
sl@0
|
989 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4107
|
sl@0
|
990 |
@SYMTestCaseDesc Performance test that measures the time taken to retrieve data to rebuild a table of ints with 22 rows
|
sl@0
|
991 |
and 8 columns, using successive calls of Find() with subsequent calls to Get for each key retrieved.
|
sl@0
|
992 |
@SYMTestPriority High
|
sl@0
|
993 |
@SYMTestActions CRepository::FindL(TUint32 aPartialKey, TUint32 aMask, RArray<TUint32>& aFoundKeys)
|
sl@0
|
994 |
CRepository::Get(TUint32 aPartialKey, TUint32 aMask, RArray<TUint32>& aFoundKeys)
|
sl@0
|
995 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
996 |
@SYMPREQ PREQ2505
|
sl@0
|
997 |
@SYMREQ REQ13142
|
sl@0
|
998 |
*/
|
sl@0
|
999 |
void RetrieveTableTestL()
|
sl@0
|
1000 |
{
|
sl@0
|
1001 |
TUint32 partialKeyData[] = {
|
sl@0
|
1002 |
0x03950000, 0x03980000, 0x039A0000, 0x039E0000, 0x03A80000, 0x03A90000,
|
sl@0
|
1003 |
0x03AA0000, 0x03AB0000, 0x03B50000, 0x03B60000, 0x03B70000, 0x03B80000,
|
sl@0
|
1004 |
0x03B90000, 0x03BA0000, 0x03BB0000, 0x03BC0000, 0x03BD0000, 0x03BE0000,
|
sl@0
|
1005 |
0x03BF0000, 0x03C00000, 0x03C10000, 0x03C20000
|
sl@0
|
1006 |
};
|
sl@0
|
1007 |
const TInt KNumRows(22); // same as number of partialKeys in array above
|
sl@0
|
1008 |
const TInt KNumCols(8); // expected number of columns per row
|
sl@0
|
1009 |
const TUint32 KMask(0xFFFF0000); // match top 2 bytes
|
sl@0
|
1010 |
|
sl@0
|
1011 |
RArray<TUint32> rowKeys(KNumCols); // set granularity to num cols
|
sl@0
|
1012 |
CleanupClosePushL(rowKeys);
|
sl@0
|
1013 |
|
sl@0
|
1014 |
TUint32 start = User::FastCounter();
|
sl@0
|
1015 |
|
sl@0
|
1016 |
for (TInt i(0); i < KNumRows; ++i)
|
sl@0
|
1017 |
{
|
sl@0
|
1018 |
// fetch all keys representing columns/cells in the row
|
sl@0
|
1019 |
// matching the key range defined by the partial key
|
sl@0
|
1020 |
TInt findErr = TheRepository->FindL(partialKeyData[i], KMask, rowKeys);
|
sl@0
|
1021 |
TEST2(findErr, KErrNone);
|
sl@0
|
1022 |
|
sl@0
|
1023 |
const TInt KColCount = rowKeys.Count();
|
sl@0
|
1024 |
TEST(KColCount == KNumCols);
|
sl@0
|
1025 |
|
sl@0
|
1026 |
// retrieve data for each column/cell represented
|
sl@0
|
1027 |
// by a key from the row key range
|
sl@0
|
1028 |
TInt value(KErrNotFound);
|
sl@0
|
1029 |
for (TInt j(0); j < KColCount; ++j)
|
sl@0
|
1030 |
{
|
sl@0
|
1031 |
TInt getErr = TheRepository->Get(rowKeys[j], value);
|
sl@0
|
1032 |
TEST2(getErr, KErrNone);
|
sl@0
|
1033 |
|
sl@0
|
1034 |
// data for these cells are 0 or 1
|
sl@0
|
1035 |
TEST(value == 0 || value == 1);
|
sl@0
|
1036 |
}
|
sl@0
|
1037 |
|
sl@0
|
1038 |
// clear our keys array for next row
|
sl@0
|
1039 |
rowKeys.Reset();
|
sl@0
|
1040 |
}
|
sl@0
|
1041 |
|
sl@0
|
1042 |
TUint32 end = User::FastCounter();
|
sl@0
|
1043 |
PrintStats(start, end);
|
sl@0
|
1044 |
|
sl@0
|
1045 |
CleanupStack::PopAndDestroy(&rowKeys);
|
sl@0
|
1046 |
}
|
sl@0
|
1047 |
|
sl@0
|
1048 |
|
sl@0
|
1049 |
/**
|
sl@0
|
1050 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4108
|
sl@0
|
1051 |
@SYMTestCaseDesc CRepository::Move(TUint32 aSourcePartialKey, TUint32 aTargetPartialKey, TUint32 aMask, TUint32 &aErrorKey) - performance test
|
sl@0
|
1052 |
The test measures the time needed for moving a single integer setting.
|
sl@0
|
1053 |
@SYMTestPriority High
|
sl@0
|
1054 |
@SYMTestActions CRepository::Move(TUint32 aSourcePartialKey, TUint32 aTargetPartialKey, TUint32 aMask, TUint32 &aErrorKey)
|
sl@0
|
1055 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
1056 |
@SYMPREQ PREQ2505
|
sl@0
|
1057 |
@SYMREQ REQ13142
|
sl@0
|
1058 |
*/
|
sl@0
|
1059 |
void MoveTest()
|
sl@0
|
1060 |
{
|
sl@0
|
1061 |
TUint32 errorKey(0);
|
sl@0
|
1062 |
|
sl@0
|
1063 |
// Move a setting to a new key
|
sl@0
|
1064 |
TUint32 start = User::FastCounter();
|
sl@0
|
1065 |
TInt err = TheRepository->Move(KNewIntKey, KNewIntKey2, 0xFFFFFFFF, errorKey);
|
sl@0
|
1066 |
TUint32 end = User::FastCounter();
|
sl@0
|
1067 |
TEST2(err, KErrNone);
|
sl@0
|
1068 |
|
sl@0
|
1069 |
// Test we get the right value from the new location
|
sl@0
|
1070 |
TInt val(0);
|
sl@0
|
1071 |
err = TheRepository->Get(KNewIntKey2, val);
|
sl@0
|
1072 |
TEST2(err, KErrNone);
|
sl@0
|
1073 |
TEST2(val, KNewIntVal);
|
sl@0
|
1074 |
|
sl@0
|
1075 |
// Test we get the KErrNotFound from the old location
|
sl@0
|
1076 |
err = TheRepository->Get(KNewIntKey, val);
|
sl@0
|
1077 |
TEST2(err, KErrNotFound);
|
sl@0
|
1078 |
|
sl@0
|
1079 |
PrintStats(start, end);
|
sl@0
|
1080 |
}
|
sl@0
|
1081 |
|
sl@0
|
1082 |
|
sl@0
|
1083 |
/**
|
sl@0
|
1084 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4109
|
sl@0
|
1085 |
@SYMTestCaseDesc CRepository::Delete(TUint32 aKey) - performance test
|
sl@0
|
1086 |
The test measures the time needed for deleting a single setting.
|
sl@0
|
1087 |
@SYMTestPriority High
|
sl@0
|
1088 |
@SYMTestActions CRepository::Delete(TUint32 aKey)
|
sl@0
|
1089 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
1090 |
@SYMPREQ PREQ2505
|
sl@0
|
1091 |
@SYMREQ REQ13142
|
sl@0
|
1092 |
*/
|
sl@0
|
1093 |
void DeleteTest()
|
sl@0
|
1094 |
{
|
sl@0
|
1095 |
// Test the setting is there and we get the right value
|
sl@0
|
1096 |
TInt val(0);
|
sl@0
|
1097 |
TInt err = TheRepository->Get(KNewIntKey2, val);
|
sl@0
|
1098 |
TEST2(err, KErrNone);
|
sl@0
|
1099 |
TEST2(val, KNewIntVal);
|
sl@0
|
1100 |
|
sl@0
|
1101 |
// Delete the setting
|
sl@0
|
1102 |
TUint32 start = User::FastCounter();
|
sl@0
|
1103 |
err = TheRepository->Delete(KNewIntKey2);
|
sl@0
|
1104 |
TUint32 end = User::FastCounter();
|
sl@0
|
1105 |
TEST2(err, KErrNone);
|
sl@0
|
1106 |
|
sl@0
|
1107 |
// Test we get the KErrNotFound from the key now
|
sl@0
|
1108 |
err = TheRepository->Get(KNewIntKey2, val);
|
sl@0
|
1109 |
TEST2(err, KErrNotFound);
|
sl@0
|
1110 |
|
sl@0
|
1111 |
PrintStats(start, end);
|
sl@0
|
1112 |
}
|
sl@0
|
1113 |
|
sl@0
|
1114 |
/**
|
sl@0
|
1115 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4110
|
sl@0
|
1116 |
@SYMTestCaseDesc CRepository::Delete(TUint32 aKey) - performance test
|
sl@0
|
1117 |
The test measures the time needed for deleting a single setting.
|
sl@0
|
1118 |
@SYMTestPriority High
|
sl@0
|
1119 |
@SYMTestActions CRepository::Delete(TUint32 aKey)
|
sl@0
|
1120 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
1121 |
@SYMPREQ PREQ2505
|
sl@0
|
1122 |
@SYMREQ REQ13142
|
sl@0
|
1123 |
*/
|
sl@0
|
1124 |
void DeleteRangeTestL()
|
sl@0
|
1125 |
{
|
sl@0
|
1126 |
TInt start(0);
|
sl@0
|
1127 |
TInt end(0);
|
sl@0
|
1128 |
TInt found(0);
|
sl@0
|
1129 |
|
sl@0
|
1130 |
// Check we can find the settings in the range
|
sl@0
|
1131 |
// (ignore timing data here as we're not timing find)
|
sl@0
|
1132 |
TInt err = FindRangeL(start, end, found);
|
sl@0
|
1133 |
TEST2(err, KErrNone);
|
sl@0
|
1134 |
TEST2(found, KFindKeyCount);
|
sl@0
|
1135 |
|
sl@0
|
1136 |
// Delete the setting
|
sl@0
|
1137 |
TUint32 errorKey(0);
|
sl@0
|
1138 |
start = User::FastCounter();
|
sl@0
|
1139 |
err = TheRepository->Delete(KFindPartialKey, KFindMask, errorKey);
|
sl@0
|
1140 |
end = User::FastCounter();
|
sl@0
|
1141 |
TEST2(err, KErrNone);
|
sl@0
|
1142 |
|
sl@0
|
1143 |
// Check we *can't* find the settings in the range now they've been deleted
|
sl@0
|
1144 |
err = FindRangeL(start, end, found);
|
sl@0
|
1145 |
TEST2(err, KErrNotFound);
|
sl@0
|
1146 |
|
sl@0
|
1147 |
PrintStats(start, end);
|
sl@0
|
1148 |
}
|
sl@0
|
1149 |
|
sl@0
|
1150 |
|
sl@0
|
1151 |
/**
|
sl@0
|
1152 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4111
|
sl@0
|
1153 |
@SYMTestCaseDesc CRepository::Reset(TUint32 aKey) - performance test
|
sl@0
|
1154 |
The test measures the time needed for resetting a single integer setting.
|
sl@0
|
1155 |
@SYMTestPriority High
|
sl@0
|
1156 |
@SYMTestActions CRepository::Reset(TUint32 aKey)
|
sl@0
|
1157 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
1158 |
@SYMPREQ PREQ2505
|
sl@0
|
1159 |
@SYMREQ REQ13142
|
sl@0
|
1160 |
*/
|
sl@0
|
1161 |
void ResetTest()
|
sl@0
|
1162 |
{
|
sl@0
|
1163 |
DoSetResetTest(EIntVal, EResetTest);
|
sl@0
|
1164 |
}
|
sl@0
|
1165 |
|
sl@0
|
1166 |
|
sl@0
|
1167 |
/**
|
sl@0
|
1168 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4112
|
sl@0
|
1169 |
@SYMTestCaseDesc CRepository::Reset() - performance test
|
sl@0
|
1170 |
The test measures the time needed for resetting the whole keyspace.
|
sl@0
|
1171 |
@SYMTestPriority High
|
sl@0
|
1172 |
@SYMTestActions CRepository::Reset()
|
sl@0
|
1173 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
1174 |
@SYMPREQ PREQ2505
|
sl@0
|
1175 |
@SYMREQ REQ13142
|
sl@0
|
1176 |
*/
|
sl@0
|
1177 |
void ResetAllTest()
|
sl@0
|
1178 |
{
|
sl@0
|
1179 |
// Check we can get the value of the newly created binary setting
|
sl@0
|
1180 |
TBool result;
|
sl@0
|
1181 |
TInt err = GetNewVal(EBinaryVal, ECreateTest, result);
|
sl@0
|
1182 |
TEST2(err, KErrNone);
|
sl@0
|
1183 |
TEST(result);
|
sl@0
|
1184 |
|
sl@0
|
1185 |
// Reset the whole keyspace
|
sl@0
|
1186 |
TInt start = User::FastCounter();
|
sl@0
|
1187 |
TheRepository->Reset();
|
sl@0
|
1188 |
TInt end = User::FastCounter();
|
sl@0
|
1189 |
TEST2(err, KErrNone);
|
sl@0
|
1190 |
|
sl@0
|
1191 |
// Check we *can't* get the value of the newly created binary setting
|
sl@0
|
1192 |
// since it shouldn't exist anymore after the Reset()
|
sl@0
|
1193 |
err = GetNewVal(EBinaryVal, ECreateTest, result);
|
sl@0
|
1194 |
TEST2(err, KErrNotFound);
|
sl@0
|
1195 |
PrintStats(start, end);
|
sl@0
|
1196 |
}
|
sl@0
|
1197 |
|
sl@0
|
1198 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
1199 |
|
sl@0
|
1200 |
// MAIN
|
sl@0
|
1201 |
|
sl@0
|
1202 |
void DoTestsL()
|
sl@0
|
1203 |
{
|
sl@0
|
1204 |
TheTest.Start(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-UT-4047 Get Int test"));
|
sl@0
|
1205 |
GetIntTest();
|
sl@0
|
1206 |
|
sl@0
|
1207 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4087 Get Real test"));
|
sl@0
|
1208 |
GetRealTest();
|
sl@0
|
1209 |
|
sl@0
|
1210 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-UT-4048 Get Binary test"));
|
sl@0
|
1211 |
GetBinaryTest();
|
sl@0
|
1212 |
|
sl@0
|
1213 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4088 Get Binary in Transaction test"));
|
sl@0
|
1214 |
GetBinaryInTransactionTest();
|
sl@0
|
1215 |
|
sl@0
|
1216 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4089 Get String test"));
|
sl@0
|
1217 |
GetStringTest();
|
sl@0
|
1218 |
|
sl@0
|
1219 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4090 GetMeta test"));
|
sl@0
|
1220 |
GetMetaTest();
|
sl@0
|
1221 |
|
sl@0
|
1222 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4091 Set Int test"));
|
sl@0
|
1223 |
SetIntTest();
|
sl@0
|
1224 |
|
sl@0
|
1225 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4092 Set Real test"));
|
sl@0
|
1226 |
SetRealTest();
|
sl@0
|
1227 |
|
sl@0
|
1228 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4093 Set Binary test"));
|
sl@0
|
1229 |
SetBinaryTest();
|
sl@0
|
1230 |
|
sl@0
|
1231 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4094 Set String test"));
|
sl@0
|
1232 |
SetStringTest();
|
sl@0
|
1233 |
|
sl@0
|
1234 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4095 Create Int setting test"));
|
sl@0
|
1235 |
CreateIntTest();
|
sl@0
|
1236 |
|
sl@0
|
1237 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4096 Create Real setting test"));
|
sl@0
|
1238 |
CreateRealTest();
|
sl@0
|
1239 |
|
sl@0
|
1240 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4097 Create Binary setting test"));
|
sl@0
|
1241 |
CreateBinaryTest();
|
sl@0
|
1242 |
|
sl@0
|
1243 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4098 Create String setting test"));
|
sl@0
|
1244 |
CreateStringTest();
|
sl@0
|
1245 |
|
sl@0
|
1246 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-UT-4049 Find test"));
|
sl@0
|
1247 |
FindTestL();
|
sl@0
|
1248 |
|
sl@0
|
1249 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4099 FindEq Int test"));
|
sl@0
|
1250 |
FindEqIntTestL();
|
sl@0
|
1251 |
|
sl@0
|
1252 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4100 FindEq Real test"));
|
sl@0
|
1253 |
FindEqRealTestL();
|
sl@0
|
1254 |
|
sl@0
|
1255 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4101 FindEq Binary test"));
|
sl@0
|
1256 |
FindEqBinaryTestL();
|
sl@0
|
1257 |
|
sl@0
|
1258 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4102 FindEq String test"));
|
sl@0
|
1259 |
FindEqStringTestL();
|
sl@0
|
1260 |
|
sl@0
|
1261 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4103 FindNeq Int test"));
|
sl@0
|
1262 |
FindNeqIntTestL();
|
sl@0
|
1263 |
|
sl@0
|
1264 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4104 FindNeq Real test"));
|
sl@0
|
1265 |
FindNeqRealTestL();
|
sl@0
|
1266 |
|
sl@0
|
1267 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4105 FindNeq Binary test"));
|
sl@0
|
1268 |
FindNeqBinaryTestL();
|
sl@0
|
1269 |
|
sl@0
|
1270 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4106 FindNeq String test"));
|
sl@0
|
1271 |
FindNeqStringTestL();
|
sl@0
|
1272 |
|
sl@0
|
1273 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4107 Retrieve structured data table test"));
|
sl@0
|
1274 |
RetrieveTableTestL();
|
sl@0
|
1275 |
|
sl@0
|
1276 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4108 Move test"));
|
sl@0
|
1277 |
MoveTest();
|
sl@0
|
1278 |
|
sl@0
|
1279 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4109 Delete test"));
|
sl@0
|
1280 |
DeleteTest();
|
sl@0
|
1281 |
|
sl@0
|
1282 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4110 Delete test"));
|
sl@0
|
1283 |
DeleteRangeTestL();
|
sl@0
|
1284 |
|
sl@0
|
1285 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4111 Reset Single test"));
|
sl@0
|
1286 |
ResetTest();
|
sl@0
|
1287 |
|
sl@0
|
1288 |
TheTest.Next(_L("@SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4112 Reset All test"));
|
sl@0
|
1289 |
ResetAllTest();
|
sl@0
|
1290 |
}
|
sl@0
|
1291 |
|
sl@0
|
1292 |
|
sl@0
|
1293 |
TInt E32Main()
|
sl@0
|
1294 |
{
|
sl@0
|
1295 |
TheTest.Title();
|
sl@0
|
1296 |
|
sl@0
|
1297 |
CTrapCleanup* tc = CTrapCleanup::New();
|
sl@0
|
1298 |
TheTest(tc != NULL);
|
sl@0
|
1299 |
|
sl@0
|
1300 |
__UHEAP_MARK;
|
sl@0
|
1301 |
|
sl@0
|
1302 |
TRAPD(err, CreateTestEnvL());
|
sl@0
|
1303 |
TEST2(err, KErrNone);
|
sl@0
|
1304 |
|
sl@0
|
1305 |
TRAP(err, DoTestsL());
|
sl@0
|
1306 |
DestroyTestEnv();
|
sl@0
|
1307 |
TEST2(err, KErrNone);
|
sl@0
|
1308 |
|
sl@0
|
1309 |
__UHEAP_MARKEND;
|
sl@0
|
1310 |
|
sl@0
|
1311 |
TheTest.End();
|
sl@0
|
1312 |
TheTest.Close();
|
sl@0
|
1313 |
|
sl@0
|
1314 |
delete tc;
|
sl@0
|
1315 |
|
sl@0
|
1316 |
User::Heap().Check();
|
sl@0
|
1317 |
return KErrNone;
|
sl@0
|
1318 |
}
|