sl@0
|
1 |
// Copyright (c) 1995-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 the License "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 |
// e32test\buffer\t_key.cpp
|
sl@0
|
15 |
// Overview:
|
sl@0
|
16 |
// Test arrays keys against flat and segmented arrays of characters (8 and 16 bit) and records.
|
sl@0
|
17 |
// API Information:
|
sl@0
|
18 |
// TKeyArrayFix, TKeyArrayVar.
|
sl@0
|
19 |
// Details:
|
sl@0
|
20 |
// - Create flat and segmented array of TText8, TText16, TText. Append some text to the
|
sl@0
|
21 |
// arrays and test the functions of the TKeyArrayFix class using the Find method which
|
sl@0
|
22 |
// calls SetPtr, Set, Compare methods with ECmpNormal8, ECmpFolded8, ECmpCollated8,
|
sl@0
|
23 |
// ECmpNormal16, ECmpFolded16, ECmpCollated16, ECmpNormal, ECmpFolded, ECmpCollated key types.
|
sl@0
|
24 |
// - Test the functions of the TKeyArrayVar class using the Find method which calls SetPtr, Set,
|
sl@0
|
25 |
// Compare methods with ECmpNormal8, ECmpFolded8, ECmpCollated8, ECmpNormal16, ECmpFolded16,
|
sl@0
|
26 |
// ECmpCollated16, ECmpNormal, ECmpFolded, ECmpCollated key types.
|
sl@0
|
27 |
// - Create flat and segmented array of TText, append some structures with different values.
|
sl@0
|
28 |
// - Test the functions of the TKeyArrayFix, TKeyArrayVar classes by searching the values using
|
sl@0
|
29 |
// sequential search technique with ECmpNormal, ECmpTInt32 key type and verifying that it is
|
sl@0
|
30 |
// found at correct position.
|
sl@0
|
31 |
// - For TKeyArrayFix and TKeyArrayVar class, create a flat array of TText, append some structures
|
sl@0
|
32 |
// with different numeric values, sort the array, search the values using ECmpTInt, ECmpTUint,
|
sl@0
|
33 |
// ECmpTint8, ECmpTUint8, ECmpTint16, ECmpTUint16, ECmpTint32, ECmpTUint32 key types and verify
|
sl@0
|
34 |
// that values are found in order as expected.
|
sl@0
|
35 |
// Platforms/Drives/Compatibility:
|
sl@0
|
36 |
// All
|
sl@0
|
37 |
// Assumptions/Requirement/Pre-requisites:
|
sl@0
|
38 |
// Failures and causes:
|
sl@0
|
39 |
// Base Port information:
|
sl@0
|
40 |
//
|
sl@0
|
41 |
//
|
sl@0
|
42 |
|
sl@0
|
43 |
#include <e32std.h>
|
sl@0
|
44 |
#include <e32std_private.h>
|
sl@0
|
45 |
#include <e32base.h>
|
sl@0
|
46 |
#include <e32base_private.h>
|
sl@0
|
47 |
#include <e32test.h>
|
sl@0
|
48 |
#include <e32svr.h>
|
sl@0
|
49 |
#include <e32ver.h>
|
sl@0
|
50 |
|
sl@0
|
51 |
#ifdef __VC32__
|
sl@0
|
52 |
#pragma warning (disable:4710) // Function not expanded
|
sl@0
|
53 |
#pragma warning (disable:4702) // Unreachable code
|
sl@0
|
54 |
#endif
|
sl@0
|
55 |
|
sl@0
|
56 |
const TInt KTestGranularity=0x02;
|
sl@0
|
57 |
|
sl@0
|
58 |
LOCAL_D RTest test(_L("T_KEY"));
|
sl@0
|
59 |
|
sl@0
|
60 |
template <class T,TInt S>
|
sl@0
|
61 |
class TArr
|
sl@0
|
62 |
{
|
sl@0
|
63 |
public:
|
sl@0
|
64 |
TArr() {}
|
sl@0
|
65 |
TInt Count() const {return S;}
|
sl@0
|
66 |
T& operator[](TInt anIndex) {return iArr[anIndex];}
|
sl@0
|
67 |
const T& operator[](TInt anIndex) const {return iArr[anIndex];}
|
sl@0
|
68 |
private:
|
sl@0
|
69 |
T iArr[S];
|
sl@0
|
70 |
};
|
sl@0
|
71 |
|
sl@0
|
72 |
//#if defined(_DEBUG)
|
sl@0
|
73 |
struct Record
|
sl@0
|
74 |
{
|
sl@0
|
75 |
TBuf<0x10> name;
|
sl@0
|
76 |
TInt32 age;
|
sl@0
|
77 |
TText8 code;
|
sl@0
|
78 |
};
|
sl@0
|
79 |
|
sl@0
|
80 |
struct Record2
|
sl@0
|
81 |
{
|
sl@0
|
82 |
TInt tint;
|
sl@0
|
83 |
TUint tuint;
|
sl@0
|
84 |
TInt8 tint8;
|
sl@0
|
85 |
TUint8 tuint8;
|
sl@0
|
86 |
TInt16 tint16;
|
sl@0
|
87 |
TUint16 tuint16;
|
sl@0
|
88 |
TInt32 tint32;
|
sl@0
|
89 |
TUint32 tuint32;
|
sl@0
|
90 |
}Rec1, Rec2, Rec3, Rec4;
|
sl@0
|
91 |
|
sl@0
|
92 |
LOCAL_C void SetRecordData(void)
|
sl@0
|
93 |
{
|
sl@0
|
94 |
Rec1.tint=KMaxTInt;
|
sl@0
|
95 |
Rec2.tint=0;
|
sl@0
|
96 |
Rec3.tint=-KMaxTInt;
|
sl@0
|
97 |
Rec4.tint=KMinTInt;
|
sl@0
|
98 |
Rec1.tint8=KMaxTInt8;
|
sl@0
|
99 |
Rec2.tint8=0;
|
sl@0
|
100 |
Rec3.tint8=-KMaxTInt8;
|
sl@0
|
101 |
Rec4.tint8=(TInt8)KMinTInt8;
|
sl@0
|
102 |
Rec1.tint16=KMaxTInt16;
|
sl@0
|
103 |
Rec2.tint16=0;
|
sl@0
|
104 |
Rec3.tint16=-KMaxTInt16;
|
sl@0
|
105 |
Rec4.tint16=(TInt16)KMinTInt16;
|
sl@0
|
106 |
Rec1.tint32=KMaxTInt32;
|
sl@0
|
107 |
Rec2.tint32=0;
|
sl@0
|
108 |
Rec3.tint32=-KMaxTInt32;
|
sl@0
|
109 |
Rec4.tint32=(TInt32)KMinTInt32;
|
sl@0
|
110 |
Rec1.tuint=0;
|
sl@0
|
111 |
Rec2.tuint=1;
|
sl@0
|
112 |
Rec3.tuint=KMaxTUint-1;
|
sl@0
|
113 |
Rec4.tuint=KMaxTUint;
|
sl@0
|
114 |
Rec1.tuint8=0;
|
sl@0
|
115 |
Rec2.tuint8=1;
|
sl@0
|
116 |
Rec3.tuint8=(TUint8)(KMaxTUint8-1);
|
sl@0
|
117 |
Rec4.tuint8=(TUint8)KMaxTUint8;
|
sl@0
|
118 |
Rec1.tuint16=0;
|
sl@0
|
119 |
Rec2.tuint16=1;
|
sl@0
|
120 |
Rec3.tuint16=(TUint16)(KMaxTUint16-1);
|
sl@0
|
121 |
Rec4.tuint16=(TUint16)KMaxTUint16;
|
sl@0
|
122 |
Rec1.tuint32=0;
|
sl@0
|
123 |
Rec2.tuint32=1;
|
sl@0
|
124 |
Rec3.tuint32=(TUint32)(KMaxTUint32-1);
|
sl@0
|
125 |
Rec4.tuint32=KMaxTUint32;
|
sl@0
|
126 |
}
|
sl@0
|
127 |
|
sl@0
|
128 |
typedef enum {eEight, eSixteen} TMode;
|
sl@0
|
129 |
|
sl@0
|
130 |
template<class KeyType, class ArrayType, class S> // S is TText8, TTExt etc. called S as _TL requires S in e32test.h
|
sl@0
|
131 |
class TestTKey
|
sl@0
|
132 |
{
|
sl@0
|
133 |
public:
|
sl@0
|
134 |
void Test1(TKeyCmpText, TKeyCmpText, TKeyCmpText);
|
sl@0
|
135 |
void Test2(TKeyCmpText, TKeyCmpText, TKeyCmpText);
|
sl@0
|
136 |
void Test3(void);
|
sl@0
|
137 |
void Test4(void);
|
sl@0
|
138 |
void Test5(void);
|
sl@0
|
139 |
void Test6(void);
|
sl@0
|
140 |
};
|
sl@0
|
141 |
|
sl@0
|
142 |
template<class KeyType, class ArrayType, class S>
|
sl@0
|
143 |
GLDEF_C void TestTKey<KeyType, ArrayType, S>::Test1(TKeyCmpText N, TKeyCmpText F, TKeyCmpText C)
|
sl@0
|
144 |
{
|
sl@0
|
145 |
// This tests the functions of the TKey classes indirectly - mostly using the Find method
|
sl@0
|
146 |
// which calls SetPtr(), Set() (both trivial) and more importantly Compare(),
|
sl@0
|
147 |
|
sl@0
|
148 |
ArrayType* pArray=new ArrayType(KTestGranularity);
|
sl@0
|
149 |
pArray->AppendL(*(const TArr<S,5>*)_TL("aa cc"));
|
sl@0
|
150 |
pArray->AppendL(*(const TArr<S,5>*)_TL("bb bb"));
|
sl@0
|
151 |
pArray->AppendL(*(const TArr<S,5>*)_TL("cc aa"));
|
sl@0
|
152 |
|
sl@0
|
153 |
KeyType NormalKey(0,N,5);
|
sl@0
|
154 |
KeyType NormalKeyOffset(sizeof(S)*3,N,2) ;
|
sl@0
|
155 |
KeyType FoldedKey(0,F,5);
|
sl@0
|
156 |
KeyType FoldedKeyOffset(sizeof(S)*3,F,2);
|
sl@0
|
157 |
KeyType CollatedKey(0,C,5);
|
sl@0
|
158 |
KeyType CollatedKeyOffset(sizeof(S)*3,C,2);
|
sl@0
|
159 |
|
sl@0
|
160 |
TInt pos;
|
sl@0
|
161 |
test(pArray->Find(*(const TArr<S,5>*)_TL("aa cc"), NormalKey, pos)==0);
|
sl@0
|
162 |
test(pos==0);
|
sl@0
|
163 |
test(pArray->Find(*(const TArr<S,5>*)_TL("bb bb"), NormalKey, pos)==0);
|
sl@0
|
164 |
test(pos==1);
|
sl@0
|
165 |
test(pArray->Find(*(const TArr<S,5>*)_TL("cc aa"), NormalKey, pos)==0);
|
sl@0
|
166 |
test(pos==2);
|
sl@0
|
167 |
test(pArray->Find(*(const TArr<S,5>*)_TL("BB BB"), NormalKey, pos)!=0);
|
sl@0
|
168 |
|
sl@0
|
169 |
|
sl@0
|
170 |
test(pArray->Find(*(const TArr<S,5>*)_TL("___cc"), NormalKeyOffset, pos)==0);
|
sl@0
|
171 |
test(pos==0);
|
sl@0
|
172 |
test(pArray->Find(*(const TArr<S,5>*)_TL("___bb"), NormalKeyOffset, pos)==0);
|
sl@0
|
173 |
test(pos==1);
|
sl@0
|
174 |
test(pArray->Find(*(const TArr<S,5>*)_TL("___aa"), NormalKeyOffset, pos)==0);
|
sl@0
|
175 |
test(pos==2);
|
sl@0
|
176 |
test(pArray->Find(*(const TArr<S,5>*)_TL("___ax"), NormalKeyOffset, pos)!=0);
|
sl@0
|
177 |
|
sl@0
|
178 |
|
sl@0
|
179 |
test(pArray->Find(*(const TArr<S,5>*)_TL("aa cc"), FoldedKey, pos)==0);
|
sl@0
|
180 |
test(pos==0);
|
sl@0
|
181 |
test(pArray->Find(*(const TArr<S,5>*)_TL("bb bb"), FoldedKey, pos)==0);
|
sl@0
|
182 |
test(pos==1);
|
sl@0
|
183 |
test(pArray->Find(*(const TArr<S,5>*)_TL("cc aa"), FoldedKey, pos)==0);
|
sl@0
|
184 |
test(pos==2);
|
sl@0
|
185 |
|
sl@0
|
186 |
|
sl@0
|
187 |
test(pArray->Find(*(const TArr<S,5>*)_TL("___CC"), FoldedKeyOffset, pos)==0);
|
sl@0
|
188 |
test(pos==0);
|
sl@0
|
189 |
test(pArray->Find(*(const TArr<S,5>*)_TL("___bB"), FoldedKeyOffset, pos)==0);
|
sl@0
|
190 |
test(pos==1);
|
sl@0
|
191 |
test(pArray->Find(*(const TArr<S,5>*)_TL("___Aa"), FoldedKeyOffset, pos)==0);
|
sl@0
|
192 |
test(pos==2);
|
sl@0
|
193 |
test(pArray->Find(*(const TArr<S,5>*)_TL("___ax"), FoldedKeyOffset, pos)!=0);
|
sl@0
|
194 |
|
sl@0
|
195 |
|
sl@0
|
196 |
test(pArray->Find(*(const TArr<S,5>*)_TL("aa cc"), CollatedKey, pos)==0);
|
sl@0
|
197 |
test(pos==0);
|
sl@0
|
198 |
test(pArray->Find(*(const TArr<S,5>*)_TL("bb bb"), CollatedKey, pos)==0);
|
sl@0
|
199 |
test(pos==1);
|
sl@0
|
200 |
test(pArray->Find(*(const TArr<S,5>*)_TL("cc aa"), CollatedKey, pos)==0);
|
sl@0
|
201 |
test(pos==2);
|
sl@0
|
202 |
|
sl@0
|
203 |
|
sl@0
|
204 |
test(pArray->Find(*(const TArr<S,5>*)_TL("___cc"), CollatedKeyOffset, pos)==0);
|
sl@0
|
205 |
test(pos==0);
|
sl@0
|
206 |
test(pArray->Find(*(const TArr<S,5>*)_TL("___bb"), CollatedKeyOffset, pos)==0);
|
sl@0
|
207 |
test(pos==1);
|
sl@0
|
208 |
test(pArray->Find(*(const TArr<S,5>*)_TL("___aa"), CollatedKeyOffset, pos)==0);
|
sl@0
|
209 |
test(pos==2);
|
sl@0
|
210 |
test(pArray->Find(*(const TArr<S,5>*)_TL("___ax"), CollatedKeyOffset, pos)!=0);
|
sl@0
|
211 |
|
sl@0
|
212 |
delete pArray;
|
sl@0
|
213 |
}
|
sl@0
|
214 |
|
sl@0
|
215 |
|
sl@0
|
216 |
template<class KeyType, class ArrayType, class S>
|
sl@0
|
217 |
GLDEF_C void TestTKey<KeyType, ArrayType, S>::Test2(TKeyCmpText N, TKeyCmpText F, TKeyCmpText C)
|
sl@0
|
218 |
{
|
sl@0
|
219 |
// This tests the functions of the TKey classes indirectly - mostly using the Find method
|
sl@0
|
220 |
// which calls SetPtr(), Set() (both trivial) and more importantly Compare(),
|
sl@0
|
221 |
|
sl@0
|
222 |
ArrayType* pArray=new ArrayType(KTestGranularity);
|
sl@0
|
223 |
pArray->AppendL(*(S(*))_TL("aa cc"), 5*sizeof(S));
|
sl@0
|
224 |
pArray->AppendL(*(S(*))_TL("bb bbb"), 6*sizeof(S));
|
sl@0
|
225 |
pArray->AppendL(*(S(*))_TL("cc aaaa"), 7*sizeof(S));
|
sl@0
|
226 |
|
sl@0
|
227 |
KeyType NormalKey5(0,N,5);
|
sl@0
|
228 |
KeyType NormalKey6(0,N,6);
|
sl@0
|
229 |
KeyType NormalKey7(0,N,7);
|
sl@0
|
230 |
KeyType NormalKeyOffset(sizeof(S)*3,N,2);
|
sl@0
|
231 |
|
sl@0
|
232 |
KeyType FoldedKey5(0,F,5);
|
sl@0
|
233 |
KeyType FoldedKey6(0,F,6);
|
sl@0
|
234 |
KeyType FoldedKey7(0,F,7);
|
sl@0
|
235 |
KeyType FoldedKeyOffset(sizeof(S)*3,F,2);
|
sl@0
|
236 |
|
sl@0
|
237 |
KeyType CollatedKey5(0,C,5);
|
sl@0
|
238 |
KeyType CollatedKey6(0,C,6);
|
sl@0
|
239 |
KeyType CollatedKey7(0,C,7);
|
sl@0
|
240 |
KeyType CollatedKeyOffset(sizeof(S)*3,C,2);
|
sl@0
|
241 |
|
sl@0
|
242 |
TInt pos;
|
sl@0
|
243 |
test(pArray->Find(*(S(*))_TL("aa cc"), NormalKey5, pos)==0);
|
sl@0
|
244 |
test(pos==0);
|
sl@0
|
245 |
test(pArray->Find(*(S(*))_TL("bb bbb"), NormalKey6, pos)==0);
|
sl@0
|
246 |
test(pos==1);
|
sl@0
|
247 |
test(pArray->Find(*(S(*))_TL("cc aaaa"), NormalKey7, pos)==0);
|
sl@0
|
248 |
test(pos==2);
|
sl@0
|
249 |
test(pArray->Find(*(S(*))_TL("BB BB"), NormalKey5, pos)!=0);
|
sl@0
|
250 |
|
sl@0
|
251 |
|
sl@0
|
252 |
test(pArray->Find(*(S(*))_TL("___cc"), NormalKeyOffset, pos)==0);
|
sl@0
|
253 |
test(pos==0);
|
sl@0
|
254 |
test(pArray->Find(*(S(*))_TL("___bb"), NormalKeyOffset, pos)==0);
|
sl@0
|
255 |
test(pos==1);
|
sl@0
|
256 |
test(pArray->Find(*(S(*))_TL("___aa"), NormalKeyOffset, pos)==0);
|
sl@0
|
257 |
test(pos==2);
|
sl@0
|
258 |
test(pArray->Find(*(S(*))_TL("___ax"), NormalKeyOffset, pos)!=0);
|
sl@0
|
259 |
|
sl@0
|
260 |
|
sl@0
|
261 |
test(pArray->Find(*(S(*))_TL("aa cc"), FoldedKey5, pos)==0);
|
sl@0
|
262 |
test(pos==0);
|
sl@0
|
263 |
test(pArray->Find(*(S(*))_TL("bb bbb"), FoldedKey6, pos)==0);
|
sl@0
|
264 |
test(pos==1);
|
sl@0
|
265 |
test(pArray->Find(*(S(*))_TL("cc aaaa"), FoldedKey7, pos)==0);
|
sl@0
|
266 |
test(pos==2);
|
sl@0
|
267 |
|
sl@0
|
268 |
|
sl@0
|
269 |
test(pArray->Find(*(S(*))_TL("___CC"), FoldedKeyOffset, pos)==0);
|
sl@0
|
270 |
test(pos==0);
|
sl@0
|
271 |
test(pArray->Find(*(S(*))_TL("___bB"), FoldedKeyOffset, pos)==0);
|
sl@0
|
272 |
test(pos==1);
|
sl@0
|
273 |
test(pArray->Find(*(S(*))_TL("___Aa"), FoldedKeyOffset, pos)==0);
|
sl@0
|
274 |
test(pos==2);
|
sl@0
|
275 |
test(pArray->Find(*(S(*))_TL("___ax"), FoldedKeyOffset, pos)!=0);
|
sl@0
|
276 |
|
sl@0
|
277 |
|
sl@0
|
278 |
test(pArray->Find(*(S(*))_TL("aa cc"), CollatedKey5, pos)==0);
|
sl@0
|
279 |
test(pos==0);
|
sl@0
|
280 |
test(pArray->Find(*(S(*))_TL("bb bbb"), CollatedKey6, pos)==0);
|
sl@0
|
281 |
test(pos==1);
|
sl@0
|
282 |
test(pArray->Find(*(S(*))_TL("cc aaaa"), CollatedKey7, pos)==0);
|
sl@0
|
283 |
test(pos==2);
|
sl@0
|
284 |
|
sl@0
|
285 |
|
sl@0
|
286 |
test(pArray->Find(*(S(*))_TL("___cc"), CollatedKeyOffset, pos)==0);
|
sl@0
|
287 |
test(pos==0);
|
sl@0
|
288 |
test(pArray->Find(*(S(*))_TL("___bb"), CollatedKeyOffset, pos)==0);
|
sl@0
|
289 |
test(pos==1);
|
sl@0
|
290 |
test(pArray->Find(*(S(*))_TL("___aa"), CollatedKeyOffset, pos)==0);
|
sl@0
|
291 |
test(pos==2);
|
sl@0
|
292 |
test(pArray->Find(*(S(*))_TL("___ax"), CollatedKeyOffset, pos)!=0);
|
sl@0
|
293 |
|
sl@0
|
294 |
delete pArray;
|
sl@0
|
295 |
}
|
sl@0
|
296 |
|
sl@0
|
297 |
|
sl@0
|
298 |
template<class KeyType, class ArrayType, class S>
|
sl@0
|
299 |
GLDEF_C void TestTKey<KeyType, ArrayType, S>::Test3(void)
|
sl@0
|
300 |
{
|
sl@0
|
301 |
ArrayType* pArray=new ArrayType(KTestGranularity);
|
sl@0
|
302 |
Record rec1, rec2, rec3;
|
sl@0
|
303 |
|
sl@0
|
304 |
rec1.name=(_TL("fred"));
|
sl@0
|
305 |
rec1.age=5;
|
sl@0
|
306 |
rec1.code='A';
|
sl@0
|
307 |
|
sl@0
|
308 |
rec2.name=(_TL("bill"));
|
sl@0
|
309 |
rec2.age=0x7fffffff;
|
sl@0
|
310 |
rec2.code='Z';
|
sl@0
|
311 |
|
sl@0
|
312 |
rec3.name=(_TL("bert"));
|
sl@0
|
313 |
rec3.age=-5;
|
sl@0
|
314 |
rec3.code='X';
|
sl@0
|
315 |
|
sl@0
|
316 |
pArray->AppendL(rec1);
|
sl@0
|
317 |
pArray->AppendL(rec2);
|
sl@0
|
318 |
pArray->AppendL(rec3);
|
sl@0
|
319 |
|
sl@0
|
320 |
TInt pos;
|
sl@0
|
321 |
|
sl@0
|
322 |
KeyType codekey(_FOFF(Record, code),ECmpNormal,1);
|
sl@0
|
323 |
test(pArray->Find(rec1, codekey, pos)==0);
|
sl@0
|
324 |
test(pos==0);
|
sl@0
|
325 |
test(pArray->Find(rec2, codekey, pos)==0);
|
sl@0
|
326 |
test(pos==1);
|
sl@0
|
327 |
test(pArray->Find(rec3, codekey, pos)==0);
|
sl@0
|
328 |
test(pos==2);
|
sl@0
|
329 |
|
sl@0
|
330 |
KeyType agekey(_FOFF(Record, age), ECmpTInt32);
|
sl@0
|
331 |
test(pArray->Find(rec1, agekey, pos)==0);
|
sl@0
|
332 |
test(pos==0);
|
sl@0
|
333 |
test(pArray->Find(rec2, agekey, pos)==0);
|
sl@0
|
334 |
test(pos==1);
|
sl@0
|
335 |
test(pArray->Find(rec3, agekey, pos)==0);
|
sl@0
|
336 |
test(pos==2);
|
sl@0
|
337 |
|
sl@0
|
338 |
rec1.age=-50; // march 95 - this isn't allowed , lucky that it works
|
sl@0
|
339 |
test(pArray->Find(rec1, agekey, pos)!=0);
|
sl@0
|
340 |
rec1.age=5;
|
sl@0
|
341 |
|
sl@0
|
342 |
pArray->Sort(agekey);
|
sl@0
|
343 |
test(pArray->Find(rec1, agekey, pos)==0);
|
sl@0
|
344 |
test(pos==1);
|
sl@0
|
345 |
test(pArray->Find(rec2, agekey, pos)==0);
|
sl@0
|
346 |
test(pos==2);
|
sl@0
|
347 |
test(pArray->Find(rec3, agekey, pos)==0);
|
sl@0
|
348 |
test(pos==0);
|
sl@0
|
349 |
|
sl@0
|
350 |
delete pArray;
|
sl@0
|
351 |
}
|
sl@0
|
352 |
|
sl@0
|
353 |
template<class KeyType, class ArrayType, class S>
|
sl@0
|
354 |
GLDEF_C void TestTKey<KeyType, ArrayType, S>::Test4(void)
|
sl@0
|
355 |
{
|
sl@0
|
356 |
ArrayType* pArray=new ArrayType(KTestGranularity);
|
sl@0
|
357 |
Record rec1, rec2, rec3;
|
sl@0
|
358 |
|
sl@0
|
359 |
rec1.name=(_TL("fred"));
|
sl@0
|
360 |
rec1.age=5;
|
sl@0
|
361 |
rec1.code='A';
|
sl@0
|
362 |
rec2.name=(_TL("bill"));
|
sl@0
|
363 |
rec2.age=0x7fffffff;
|
sl@0
|
364 |
rec2.code='Z';
|
sl@0
|
365 |
rec3.name=(_TL("bert"));
|
sl@0
|
366 |
rec3.age=-5;
|
sl@0
|
367 |
rec3.code='X';
|
sl@0
|
368 |
|
sl@0
|
369 |
pArray->AppendL(rec1, sizeof(Record));
|
sl@0
|
370 |
pArray->AppendL(rec2, sizeof(Record));
|
sl@0
|
371 |
pArray->AppendL(rec3, sizeof(Record));
|
sl@0
|
372 |
|
sl@0
|
373 |
TInt pos;
|
sl@0
|
374 |
KeyType codekey(_FOFF(Record, code),ECmpNormal,1);
|
sl@0
|
375 |
test(pArray->Find(rec1, codekey, pos)==0);
|
sl@0
|
376 |
test(pos==0);
|
sl@0
|
377 |
test(pArray->Find(rec2, codekey, pos)==0);
|
sl@0
|
378 |
test(pos==1);
|
sl@0
|
379 |
test(pArray->Find(rec3, codekey, pos)==0);
|
sl@0
|
380 |
test(pos==2);
|
sl@0
|
381 |
|
sl@0
|
382 |
KeyType agekey(_FOFF(Record, age), ECmpTInt32);
|
sl@0
|
383 |
test(pArray->Find(rec1, agekey, pos)==0);
|
sl@0
|
384 |
test(pos==0);
|
sl@0
|
385 |
test(pArray->Find(rec2, agekey, pos)==0);
|
sl@0
|
386 |
test(pos==1);
|
sl@0
|
387 |
test(pArray->Find(rec3, agekey, pos)==0);
|
sl@0
|
388 |
test(pos==2);
|
sl@0
|
389 |
rec1.age=-50; // march 95 - this isn't allowed - lucky to get away with it
|
sl@0
|
390 |
test(pArray->Find(rec1, agekey, pos)!=0);
|
sl@0
|
391 |
rec1.age=5;
|
sl@0
|
392 |
|
sl@0
|
393 |
pArray->Sort(agekey);
|
sl@0
|
394 |
test(pArray->Find(rec1, agekey, pos)==0);
|
sl@0
|
395 |
test(pos==1);
|
sl@0
|
396 |
test(pArray->Find(rec2, agekey, pos)==0);
|
sl@0
|
397 |
test(pos==2);
|
sl@0
|
398 |
test(pArray->Find(rec3, agekey, pos)==0);
|
sl@0
|
399 |
test(pos==0);
|
sl@0
|
400 |
|
sl@0
|
401 |
delete pArray;
|
sl@0
|
402 |
}
|
sl@0
|
403 |
|
sl@0
|
404 |
template<class KeyType, class ArrayType, class S>
|
sl@0
|
405 |
GLDEF_C void TestTKey<KeyType, ArrayType, S>::Test5(void)
|
sl@0
|
406 |
{
|
sl@0
|
407 |
// test the numeric enumeration types
|
sl@0
|
408 |
ArrayType* pArray=new ArrayType(KTestGranularity);
|
sl@0
|
409 |
TInt pos;
|
sl@0
|
410 |
|
sl@0
|
411 |
KeyType TIntKey(_FOFF(Record2, tint), ECmpTInt);
|
sl@0
|
412 |
KeyType TUintKey(_FOFF(Record2, tuint), ECmpTUint);
|
sl@0
|
413 |
KeyType TInt8Key(_FOFF(Record2, tint8), ECmpTInt8);
|
sl@0
|
414 |
KeyType TUint8Key(_FOFF(Record2, tuint8), ECmpTUint8);
|
sl@0
|
415 |
KeyType TInt16Key(_FOFF(Record2, tint16), ECmpTInt16);
|
sl@0
|
416 |
KeyType TUint16Key(_FOFF(Record2, tuint16), ECmpTUint16);
|
sl@0
|
417 |
KeyType TInt32Key(_FOFF(Record2, tint32), ECmpTInt32);
|
sl@0
|
418 |
KeyType TUint32Key(_FOFF(Record2, tuint32), ECmpTUint32);
|
sl@0
|
419 |
|
sl@0
|
420 |
SetRecordData();
|
sl@0
|
421 |
|
sl@0
|
422 |
pArray->AppendL(Rec1);
|
sl@0
|
423 |
pArray->AppendL(Rec2);
|
sl@0
|
424 |
pArray->AppendL(Rec3);
|
sl@0
|
425 |
pArray->AppendL(Rec4);
|
sl@0
|
426 |
|
sl@0
|
427 |
pArray->Sort(TIntKey);
|
sl@0
|
428 |
// order should be 4,3,2,1
|
sl@0
|
429 |
test(pArray->Find(Rec4, TIntKey, pos)==0);
|
sl@0
|
430 |
test(pos==0);
|
sl@0
|
431 |
test(pArray->Find(Rec3, TIntKey, pos)==0);
|
sl@0
|
432 |
test(pos==1);
|
sl@0
|
433 |
test(pArray->Find(Rec2, TIntKey, pos)==0);
|
sl@0
|
434 |
test(pos==2);
|
sl@0
|
435 |
test(pArray->Find(Rec1, TIntKey, pos)==0);
|
sl@0
|
436 |
test(pos==3);
|
sl@0
|
437 |
|
sl@0
|
438 |
pArray->Sort(TUintKey);
|
sl@0
|
439 |
// order should be 1,2,3,4
|
sl@0
|
440 |
test(pArray->Find(Rec1, TUintKey, pos)==0);
|
sl@0
|
441 |
test(pos==0);
|
sl@0
|
442 |
test(pArray->Find(Rec2, TUintKey, pos)==0);
|
sl@0
|
443 |
test(pos==1);
|
sl@0
|
444 |
test(pArray->Find(Rec3, TUintKey, pos)==0);
|
sl@0
|
445 |
test(pos==2);
|
sl@0
|
446 |
test(pArray->Find(Rec4, TUintKey, pos)==0);
|
sl@0
|
447 |
test(pos==3);
|
sl@0
|
448 |
|
sl@0
|
449 |
pArray->Sort(TInt8Key);
|
sl@0
|
450 |
// order should be 4,3,2,1
|
sl@0
|
451 |
test(pArray->Find(Rec4, TInt8Key, pos)==0);
|
sl@0
|
452 |
test(pos==0);
|
sl@0
|
453 |
test(pArray->Find(Rec3, TInt8Key, pos)==0);
|
sl@0
|
454 |
test(pos==1);
|
sl@0
|
455 |
test(pArray->Find(Rec2, TInt8Key, pos)==0);
|
sl@0
|
456 |
test(pos==2);
|
sl@0
|
457 |
test(pArray->Find(Rec1, TInt8Key, pos)==0);
|
sl@0
|
458 |
test(pos==3);
|
sl@0
|
459 |
|
sl@0
|
460 |
pArray->Sort(TUint8Key);
|
sl@0
|
461 |
// order should be 1,2,3,4
|
sl@0
|
462 |
test(pArray->Find(Rec1, TUint8Key, pos)==0);
|
sl@0
|
463 |
test(pos==0);
|
sl@0
|
464 |
test(pArray->Find(Rec2, TUint8Key, pos)==0);
|
sl@0
|
465 |
test(pos==1);
|
sl@0
|
466 |
test(pArray->Find(Rec3, TUint8Key, pos)==0);
|
sl@0
|
467 |
test(pos==2);
|
sl@0
|
468 |
test(pArray->Find(Rec4, TUint8Key, pos)==0);
|
sl@0
|
469 |
test(pos==3);
|
sl@0
|
470 |
|
sl@0
|
471 |
pArray->Sort(TInt16Key);
|
sl@0
|
472 |
// order should be 4,3,2,1
|
sl@0
|
473 |
test(pArray->Find(Rec4, TInt16Key, pos)==0);
|
sl@0
|
474 |
test(pos==0);
|
sl@0
|
475 |
test(pArray->Find(Rec3, TInt16Key, pos)==0);
|
sl@0
|
476 |
test(pos==1);
|
sl@0
|
477 |
test(pArray->Find(Rec2, TInt16Key, pos)==0);
|
sl@0
|
478 |
test(pos==2);
|
sl@0
|
479 |
test(pArray->Find(Rec1, TInt16Key, pos)==0);
|
sl@0
|
480 |
test(pos==3);
|
sl@0
|
481 |
|
sl@0
|
482 |
pArray->Sort(TUintKey);
|
sl@0
|
483 |
// order should be 1,2,3,4
|
sl@0
|
484 |
test(pArray->Find(Rec1, TUint16Key, pos)==0);
|
sl@0
|
485 |
test(pos==0);
|
sl@0
|
486 |
test(pArray->Find(Rec2, TUint16Key, pos)==0);
|
sl@0
|
487 |
test(pos==1);
|
sl@0
|
488 |
test(pArray->Find(Rec3, TUint16Key, pos)==0);
|
sl@0
|
489 |
test(pos==2);
|
sl@0
|
490 |
test(pArray->Find(Rec4, TUint16Key, pos)==0);
|
sl@0
|
491 |
test(pos==3);
|
sl@0
|
492 |
|
sl@0
|
493 |
pArray->Sort(TInt32Key);
|
sl@0
|
494 |
// order should be 4,3,2,1
|
sl@0
|
495 |
test(pArray->Find(Rec4, TInt32Key, pos)==0);
|
sl@0
|
496 |
test(pos==0);
|
sl@0
|
497 |
test(pArray->Find(Rec3, TInt32Key, pos)==0);
|
sl@0
|
498 |
test(pos==1);
|
sl@0
|
499 |
test(pArray->Find(Rec2, TInt32Key, pos)==0);
|
sl@0
|
500 |
test(pos==2);
|
sl@0
|
501 |
test(pArray->Find(Rec1, TInt32Key, pos)==0);
|
sl@0
|
502 |
test(pos==3);
|
sl@0
|
503 |
|
sl@0
|
504 |
pArray->Sort(TUint32Key);
|
sl@0
|
505 |
// order should be 1,2,3,4
|
sl@0
|
506 |
test(pArray->Find(Rec1, TUint32Key, pos)==0);
|
sl@0
|
507 |
test(pos==0);
|
sl@0
|
508 |
test(pArray->Find(Rec2, TUint32Key, pos)==0);
|
sl@0
|
509 |
test(pos==1);
|
sl@0
|
510 |
test(pArray->Find(Rec3, TUint32Key, pos)==0);
|
sl@0
|
511 |
test(pos==2);
|
sl@0
|
512 |
test(pArray->Find(Rec4, TUint32Key, pos)==0);
|
sl@0
|
513 |
test(pos==3);
|
sl@0
|
514 |
|
sl@0
|
515 |
delete pArray;
|
sl@0
|
516 |
}
|
sl@0
|
517 |
|
sl@0
|
518 |
template<class KeyType, class ArrayType, class S>
|
sl@0
|
519 |
GLDEF_C void TestTKey<KeyType, ArrayType, S>::Test6(void)
|
sl@0
|
520 |
{
|
sl@0
|
521 |
// test the numeric enumeration types
|
sl@0
|
522 |
ArrayType* pArray=new ArrayType(KTestGranularity);
|
sl@0
|
523 |
TInt pos;
|
sl@0
|
524 |
|
sl@0
|
525 |
KeyType TIntKey(_FOFF(Record2, tint), ECmpTInt);
|
sl@0
|
526 |
KeyType TUintKey(_FOFF(Record2, tuint), ECmpTUint);
|
sl@0
|
527 |
KeyType TInt8Key(_FOFF(Record2, tint8), ECmpTInt8);
|
sl@0
|
528 |
KeyType TUint8Key(_FOFF(Record2, tuint8), ECmpTUint8);
|
sl@0
|
529 |
KeyType TInt16Key(_FOFF(Record2, tint16), ECmpTInt16);
|
sl@0
|
530 |
KeyType TUint16Key(_FOFF(Record2, tuint16), ECmpTUint16);
|
sl@0
|
531 |
KeyType TInt32Key(_FOFF(Record2, tint32), ECmpTInt32);
|
sl@0
|
532 |
KeyType TUint32Key(_FOFF(Record2, tuint32), ECmpTUint32);
|
sl@0
|
533 |
|
sl@0
|
534 |
SetRecordData();
|
sl@0
|
535 |
|
sl@0
|
536 |
pArray->AppendL(Rec1, sizeof(Record2));
|
sl@0
|
537 |
pArray->AppendL(Rec2, sizeof(Record2));
|
sl@0
|
538 |
pArray->AppendL(Rec3, sizeof(Record2));
|
sl@0
|
539 |
pArray->AppendL(Rec4, sizeof(Record2));
|
sl@0
|
540 |
|
sl@0
|
541 |
pArray->Sort(TIntKey);
|
sl@0
|
542 |
// order should be 4,3,2,1
|
sl@0
|
543 |
test(pArray->Find(Rec4, TIntKey, pos)==0);
|
sl@0
|
544 |
test(pos==0);
|
sl@0
|
545 |
test(pArray->Find(Rec3, TIntKey, pos)==0);
|
sl@0
|
546 |
test(pos==1);
|
sl@0
|
547 |
test(pArray->Find(Rec2, TIntKey, pos)==0);
|
sl@0
|
548 |
test(pos==2);
|
sl@0
|
549 |
test(pArray->Find(Rec1, TIntKey, pos)==0);
|
sl@0
|
550 |
test(pos==3);
|
sl@0
|
551 |
|
sl@0
|
552 |
pArray->Sort(TUintKey);
|
sl@0
|
553 |
// order should be 1,2,3,4
|
sl@0
|
554 |
test(pArray->Find(Rec1, TUintKey, pos)==0);
|
sl@0
|
555 |
test(pos==0);
|
sl@0
|
556 |
test(pArray->Find(Rec2, TUintKey, pos)==0);
|
sl@0
|
557 |
test(pos==1);
|
sl@0
|
558 |
test(pArray->Find(Rec3, TUintKey, pos)==0);
|
sl@0
|
559 |
test(pos==2);
|
sl@0
|
560 |
test(pArray->Find(Rec4, TUintKey, pos)==0);
|
sl@0
|
561 |
test(pos==3);
|
sl@0
|
562 |
|
sl@0
|
563 |
pArray->Sort(TInt8Key);
|
sl@0
|
564 |
// order should be 4,3,2,1
|
sl@0
|
565 |
test(pArray->Find(Rec4, TInt8Key, pos)==0);
|
sl@0
|
566 |
test(pos==0);
|
sl@0
|
567 |
test(pArray->Find(Rec3, TInt8Key, pos)==0);
|
sl@0
|
568 |
test(pos==1);
|
sl@0
|
569 |
test(pArray->Find(Rec2, TInt8Key, pos)==0);
|
sl@0
|
570 |
test(pos==2);
|
sl@0
|
571 |
test(pArray->Find(Rec1, TInt8Key, pos)==0);
|
sl@0
|
572 |
test(pos==3);
|
sl@0
|
573 |
|
sl@0
|
574 |
pArray->Sort(TUint8Key);
|
sl@0
|
575 |
// order should be 1,2,3,4
|
sl@0
|
576 |
test(pArray->Find(Rec1, TUint8Key, pos)==0);
|
sl@0
|
577 |
test(pos==0);
|
sl@0
|
578 |
test(pArray->Find(Rec2, TUint8Key, pos)==0);
|
sl@0
|
579 |
test(pos==1);
|
sl@0
|
580 |
test(pArray->Find(Rec3, TUint8Key, pos)==0);
|
sl@0
|
581 |
test(pos==2);
|
sl@0
|
582 |
test(pArray->Find(Rec4, TUint8Key, pos)==0);
|
sl@0
|
583 |
test(pos==3);
|
sl@0
|
584 |
|
sl@0
|
585 |
pArray->Sort(TInt16Key);
|
sl@0
|
586 |
// order should be 4,3,2,1
|
sl@0
|
587 |
test(pArray->Find(Rec4, TInt16Key, pos)==0);
|
sl@0
|
588 |
test(pos==0);
|
sl@0
|
589 |
test(pArray->Find(Rec3, TInt16Key, pos)==0);
|
sl@0
|
590 |
test(pos==1);
|
sl@0
|
591 |
test(pArray->Find(Rec2, TInt16Key, pos)==0);
|
sl@0
|
592 |
test(pos==2);
|
sl@0
|
593 |
test(pArray->Find(Rec1, TInt16Key, pos)==0);
|
sl@0
|
594 |
test(pos==3);
|
sl@0
|
595 |
|
sl@0
|
596 |
pArray->Sort(TUintKey);
|
sl@0
|
597 |
// order should be 1,2,3,4
|
sl@0
|
598 |
test(pArray->Find(Rec1, TUint16Key, pos)==0);
|
sl@0
|
599 |
test(pos==0);
|
sl@0
|
600 |
test(pArray->Find(Rec2, TUint16Key, pos)==0);
|
sl@0
|
601 |
test(pos==1);
|
sl@0
|
602 |
test(pArray->Find(Rec3, TUint16Key, pos)==0);
|
sl@0
|
603 |
test(pos==2);
|
sl@0
|
604 |
test(pArray->Find(Rec4, TUint16Key, pos)==0);
|
sl@0
|
605 |
test(pos==3);
|
sl@0
|
606 |
|
sl@0
|
607 |
pArray->Sort(TInt32Key);
|
sl@0
|
608 |
// order should be 4,3,2,1
|
sl@0
|
609 |
test(pArray->Find(Rec4, TInt32Key, pos)==0);
|
sl@0
|
610 |
test(pos==0);
|
sl@0
|
611 |
test(pArray->Find(Rec3, TInt32Key, pos)==0);
|
sl@0
|
612 |
test(pos==1);
|
sl@0
|
613 |
test(pArray->Find(Rec2, TInt32Key, pos)==0);
|
sl@0
|
614 |
test(pos==2);
|
sl@0
|
615 |
test(pArray->Find(Rec1, TInt32Key, pos)==0);
|
sl@0
|
616 |
test(pos==3);
|
sl@0
|
617 |
|
sl@0
|
618 |
pArray->Sort(TUint32Key);
|
sl@0
|
619 |
// order should be 1,2,3,4
|
sl@0
|
620 |
test(pArray->Find(Rec1, TUint32Key, pos)==0);
|
sl@0
|
621 |
test(pos==0);
|
sl@0
|
622 |
test(pArray->Find(Rec2, TUint32Key, pos)==0);
|
sl@0
|
623 |
test(pos==1);
|
sl@0
|
624 |
test(pArray->Find(Rec3, TUint32Key, pos)==0);
|
sl@0
|
625 |
test(pos==2);
|
sl@0
|
626 |
test(pArray->Find(Rec4, TUint32Key, pos)==0);
|
sl@0
|
627 |
test(pos==3);
|
sl@0
|
628 |
|
sl@0
|
629 |
delete pArray;
|
sl@0
|
630 |
}
|
sl@0
|
631 |
|
sl@0
|
632 |
GLDEF_C TInt E32Main()
|
sl@0
|
633 |
{
|
sl@0
|
634 |
|
sl@0
|
635 |
test.Title();
|
sl@0
|
636 |
test.Start(_L("Fixed key class with a flat array of TText8"));
|
sl@0
|
637 |
typedef CArrayFixFlat<TArr<TText8,5> > aFixedFlatArrayOfTText8;
|
sl@0
|
638 |
TestTKey<TKeyArrayFix, aFixedFlatArrayOfTText8, TText8> T1;
|
sl@0
|
639 |
T1.Test1(ECmpNormal8, ECmpFolded8, ECmpCollated8);
|
sl@0
|
640 |
|
sl@0
|
641 |
test.Next(_L("Fixed key class with a flat array of TText16"));
|
sl@0
|
642 |
typedef CArrayFixFlat<TArr<TText16,5> > aFixedFlatArrayOfTText16;
|
sl@0
|
643 |
TestTKey<TKeyArrayFix, aFixedFlatArrayOfTText16, TText16> T2;
|
sl@0
|
644 |
T2.Test1(ECmpNormal16, ECmpFolded16, ECmpCollated16);
|
sl@0
|
645 |
|
sl@0
|
646 |
test.Next(_L("Fixed key class with a flat array of TText"));
|
sl@0
|
647 |
typedef CArrayFixFlat<TArr<TText,5> > aFixedFlatArrayOfTText;
|
sl@0
|
648 |
TestTKey<TKeyArrayFix, aFixedFlatArrayOfTText, TText> T3;
|
sl@0
|
649 |
T3.Test1(ECmpNormal, ECmpFolded, ECmpCollated);
|
sl@0
|
650 |
|
sl@0
|
651 |
test.Next(_L("Fixed key class with a segmented array of TText8"));
|
sl@0
|
652 |
typedef CArrayFixSeg<TArr<TText8,5> > aFixedSegmentedArrayOfTText8;
|
sl@0
|
653 |
TestTKey<TKeyArrayFix, aFixedSegmentedArrayOfTText8, TText8> T4;
|
sl@0
|
654 |
T4.Test1(ECmpNormal8, ECmpFolded8, ECmpCollated8);
|
sl@0
|
655 |
|
sl@0
|
656 |
test.Next(_L("Fixed key class with a segmented array of TText16"));
|
sl@0
|
657 |
typedef CArrayFixSeg<TArr<TText16,5> > aFixedSegmentedArrayOfTText16;
|
sl@0
|
658 |
TestTKey<TKeyArrayFix, aFixedSegmentedArrayOfTText16, TText16> T5;
|
sl@0
|
659 |
T5.Test1(ECmpNormal16, ECmpFolded16, ECmpCollated16);
|
sl@0
|
660 |
|
sl@0
|
661 |
test.Next(_L("Fixed key class with a segmented array of TText"));
|
sl@0
|
662 |
typedef CArrayFixSeg<TArr<TText,5> > aFixedSegmentedArrayOfTText;
|
sl@0
|
663 |
TestTKey<TKeyArrayFix, aFixedSegmentedArrayOfTText, TText> T6;
|
sl@0
|
664 |
T6.Test1(ECmpNormal, ECmpFolded, ECmpCollated);
|
sl@0
|
665 |
|
sl@0
|
666 |
test.Next(_L("Var key with a flat array of TText8"));
|
sl@0
|
667 |
typedef CArrayVarFlat<TText8> aVarFlatArrayOfTText8;
|
sl@0
|
668 |
TestTKey<TKeyArrayVar, aVarFlatArrayOfTText8, TText8> T7;
|
sl@0
|
669 |
T7.Test2(ECmpNormal8, ECmpFolded8, ECmpCollated8);
|
sl@0
|
670 |
|
sl@0
|
671 |
test.Next(_L("Var key with a flat array of TText16"));
|
sl@0
|
672 |
typedef CArrayVarFlat<TText16> aVarFlatArrayOfTText16;
|
sl@0
|
673 |
TestTKey<TKeyArrayVar, aVarFlatArrayOfTText16, TText16> T8;
|
sl@0
|
674 |
T8.Test2(ECmpNormal16, ECmpFolded16, ECmpCollated16);
|
sl@0
|
675 |
|
sl@0
|
676 |
test.Next(_L("Var key with a flat array of TText"));
|
sl@0
|
677 |
typedef CArrayVarFlat<TText> aVarFlatArrayOfTText;
|
sl@0
|
678 |
TestTKey<TKeyArrayVar, aVarFlatArrayOfTText, TText> T9;
|
sl@0
|
679 |
T9.Test2(ECmpNormal, ECmpFolded, ECmpCollated);
|
sl@0
|
680 |
|
sl@0
|
681 |
test.Next(_L("Var key with a segmented array of TText8"));
|
sl@0
|
682 |
typedef CArrayVarSeg<TText8> aVarSegmentedArrayOfTText8;
|
sl@0
|
683 |
TestTKey<TKeyArrayVar, aVarSegmentedArrayOfTText8, TText8> T10;
|
sl@0
|
684 |
T10.Test2(ECmpNormal8, ECmpFolded8, ECmpCollated8);
|
sl@0
|
685 |
|
sl@0
|
686 |
test.Next(_L("Var key with a segmented array of TText16"));
|
sl@0
|
687 |
typedef CArrayVarSeg<TText16> aVarSegmentedArrayOfTText16;
|
sl@0
|
688 |
TestTKey<TKeyArrayVar, aVarSegmentedArrayOfTText16, TText16> T11;
|
sl@0
|
689 |
T11.Test2(ECmpNormal16, ECmpFolded16, ECmpCollated16);
|
sl@0
|
690 |
|
sl@0
|
691 |
test.Next(_L("Var key with a segmented array of TText"));
|
sl@0
|
692 |
typedef CArrayVarSeg<TText> aVarSegmentedArrayOfTText;
|
sl@0
|
693 |
TestTKey<TKeyArrayVar, aVarSegmentedArrayOfTText, TText> T12;
|
sl@0
|
694 |
T12.Test2(ECmpNormal, ECmpFolded, ECmpCollated);
|
sl@0
|
695 |
|
sl@0
|
696 |
test.Next(_L("Fixed key with a flat array of structs"));
|
sl@0
|
697 |
typedef CArrayFixFlat<Record> aFixedFlatArrayOfRecord;
|
sl@0
|
698 |
TestTKey<TKeyArrayFix, aFixedFlatArrayOfRecord, TText> T13;
|
sl@0
|
699 |
T13.Test3();
|
sl@0
|
700 |
|
sl@0
|
701 |
test.Next(_L("Fixed key with a segmented array of structs"));
|
sl@0
|
702 |
typedef CArrayFixSeg<Record> aFixedSegmentedArrayOfRecord;
|
sl@0
|
703 |
TestTKey<TKeyArrayFix, aFixedSegmentedArrayOfRecord, TText> T14;
|
sl@0
|
704 |
T14.Test3();
|
sl@0
|
705 |
|
sl@0
|
706 |
test.Next(_L("Var key with a flat array of structs"));
|
sl@0
|
707 |
typedef CArrayVarFlat<Record> aVarFlatArrayOfRecord;
|
sl@0
|
708 |
TestTKey<TKeyArrayVar, aVarFlatArrayOfRecord, TText> T15;
|
sl@0
|
709 |
T15.Test4();
|
sl@0
|
710 |
|
sl@0
|
711 |
test.Next(_L("Var key with a segmented array of structs"));
|
sl@0
|
712 |
typedef CArrayVarSeg<Record> aVarSegmentedArrayOfRecord;
|
sl@0
|
713 |
TestTKey<TKeyArrayVar, aVarSegmentedArrayOfRecord, TText> T16;
|
sl@0
|
714 |
T16.Test4();
|
sl@0
|
715 |
|
sl@0
|
716 |
test.Next(_L("Fixed key with a flat array of structs testing numeric types"));
|
sl@0
|
717 |
typedef CArrayFixFlat<Record2> aFixedFlatArrayOfRecord2;
|
sl@0
|
718 |
TestTKey<TKeyArrayFix, aFixedFlatArrayOfRecord2, TText> T17;
|
sl@0
|
719 |
T17.Test5();
|
sl@0
|
720 |
|
sl@0
|
721 |
test.Next(_L("Var key with a flat array of structs testing numeric types"));
|
sl@0
|
722 |
typedef CArrayVarFlat<Record2> aVarFlatArrayOfRecord2;
|
sl@0
|
723 |
TestTKey<TKeyArrayVar, aVarFlatArrayOfRecord2, TText> T18;
|
sl@0
|
724 |
T18.Test6();
|
sl@0
|
725 |
test.End();
|
sl@0
|
726 |
return(KErrNone);
|
sl@0
|
727 |
}
|
sl@0
|
728 |
|
sl@0
|
729 |
/*#else
|
sl@0
|
730 |
GLDEF_C TInt E32Main()
|
sl@0
|
731 |
//
|
sl@0
|
732 |
// Test unavailable in release build.
|
sl@0
|
733 |
//
|
sl@0
|
734 |
{
|
sl@0
|
735 |
|
sl@0
|
736 |
test.Title();
|
sl@0
|
737 |
test.Start(_L("No tests for release builds"));
|
sl@0
|
738 |
test.End();
|
sl@0
|
739 |
return(0);
|
sl@0
|
740 |
}
|
sl@0
|
741 |
#endif
|
sl@0
|
742 |
|
sl@0
|
743 |
*/
|
sl@0
|
744 |
|