|
1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "CDelimitedPathSegmentTest.h" |
|
17 |
|
18 #include <e32base.h> |
|
19 #include <delimitedpathsegment16.h> |
|
20 #include <delimitedpathsegment8.h> |
|
21 |
|
22 #include "TDelimitedDataCommon.h" |
|
23 #include "DelimitedPathSegmentTests.h" |
|
24 |
|
25 // Constants |
|
26 // |
|
27 _LIT(KTitle16Bit, "%S (16-Bit)"); |
|
28 _LIT(KTitle8Bit, "%S (8-Bit)"); |
|
29 |
|
30 CDelimitedPathSegmentTest* CDelimitedPathSegmentTest::NewLC(CIpuTestHarness* aTestHarness) |
|
31 { |
|
32 CDelimitedPathSegmentTest* self = new (ELeave) CDelimitedPathSegmentTest(aTestHarness); |
|
33 CleanupStack::PushL(self); |
|
34 self->ConstructL(); |
|
35 return self; |
|
36 } |
|
37 |
|
38 CDelimitedPathSegmentTest* CDelimitedPathSegmentTest::NewL(CIpuTestHarness* aTestHarness) |
|
39 { |
|
40 CDelimitedPathSegmentTest* self = CDelimitedPathSegmentTest::NewLC(aTestHarness); |
|
41 CleanupStack::Pop(self); |
|
42 return self; |
|
43 } |
|
44 |
|
45 CDelimitedPathSegmentTest::CDelimitedPathSegmentTest(CIpuTestHarness* aTestHarness) |
|
46 : iTestHarness(aTestHarness) |
|
47 { |
|
48 } |
|
49 |
|
50 void CDelimitedPathSegmentTest::ConstructL() |
|
51 { |
|
52 } |
|
53 |
|
54 CDelimitedPathSegmentTest::~CDelimitedPathSegmentTest() |
|
55 { |
|
56 } |
|
57 |
|
58 void CDelimitedPathSegmentTest::DoTestsL() |
|
59 { |
|
60 // |
|
61 // |
|
62 // Delimited PathSegment Tests |
|
63 // |
|
64 // |
|
65 |
|
66 TestDelimitedPathSegmentExtractionL(KPathSegmentParse0, &KPathSegmentParse0Seg0(), &KPathSegmentParse0Seg1(), |
|
67 &KPathSegmentParse0Seg2(), NULL); |
|
68 TestDelimitedPathSegmentExtractionL(KPathSegmentParse1, &KPathSegmentParse1Seg0(), &KPathSegmentParse1Seg1(), &KPathSegmentParse1Seg2(), |
|
69 &KPathSegmentParse1Seg3(), NULL); |
|
70 TestDelimitedPathSegmentExtractionL(KPathSegmentParse2, &KPathSegmentParse2Seg0(), &KPathSegmentParse2Seg1(), &KPathSegmentParse2Seg2(), |
|
71 &KPathSegmentParse2Seg3(), &KPathSegmentParse2Seg4(), &KPathSegmentParse2Seg5(), &KPathSegmentParse2Seg6(), |
|
72 &KPathSegmentParse2Seg7(), NULL); |
|
73 |
|
74 TestDelimitedPathSegmentReverseExtractionL(KPathSegmentParse0, &KPathSegmentParse0Seg2(), |
|
75 &KPathSegmentParse0Seg1(), &KPathSegmentParse0Seg0(), NULL); |
|
76 TestDelimitedPathSegmentReverseExtractionL(KPathSegmentParse1, &KPathSegmentParse1Seg3(), &KPathSegmentParse1Seg2(), |
|
77 &KPathSegmentParse1Seg1(), &KPathSegmentParse1Seg0(), NULL); |
|
78 TestDelimitedPathSegmentReverseExtractionL(KPathSegmentParse2, &KPathSegmentParse2Seg7(), &KPathSegmentParse2Seg6(), |
|
79 &KPathSegmentParse2Seg5(), &KPathSegmentParse2Seg4(), &KPathSegmentParse2Seg3(), |
|
80 &KPathSegmentParse2Seg2(), &KPathSegmentParse2Seg1(), &KPathSegmentParse2Seg0(), NULL); |
|
81 |
|
82 TestDelimitedPathSegmentDelimiterPresenceL(KPathSegment_DelimPresence0, KPathSegment_FrontDelim0, KPathSegment_BackDelim0); |
|
83 TestDelimitedPathSegmentDelimiterPresenceL(KPathSegment_DelimPresence1, KPathSegment_FrontDelim1, KPathSegment_BackDelim1); |
|
84 TestDelimitedPathSegmentDelimiterPresenceL(KPathSegment_DelimPresence2, KPathSegment_FrontDelim2, KPathSegment_BackDelim2); |
|
85 TestDelimitedPathSegmentDelimiterPresenceL(KPathSegment_DelimPresence3, KPathSegment_FrontDelim3, KPathSegment_BackDelim3); |
|
86 |
|
87 TestDelimitedPathSegmentRemainderL(KPathSegment_Rem_Forwards0_0, &KPathSegment_Rem_Forwards0_0(), &KPathSegment_Rem_Forwards0_1(), |
|
88 &KPathSegment_Rem_Forwards0_2(), &KPathSegment_Rem_Forwards0_3(), NULL); |
|
89 |
|
90 TestDelimitedPathSegmentRemainderReverseL(KPathSegment_Rem_Backwards0_0, &KPathSegment_Rem_Backwards0_0(), &KPathSegment_Rem_Backwards0_1(), |
|
91 &KPathSegment_Rem_Backwards0_2(), &KPathSegment_Rem_Backwards0_3(), NULL); |
|
92 |
|
93 TestDelimitedPathSegmentDesL(KPathSegment_Des0); |
|
94 |
|
95 TestDelimitedPathSegmentPushFrontL(KPathSegment_PushPopFront0_0, &KPathSegment_Push0_a(), &KPathSegment_PushPopFront0_1(), |
|
96 &KPathSegment_Push0_b(), &KPathSegment_PushPopFront0_2(), |
|
97 &KPathSegment_Push0_c(), &KPathSegment_PushPopFront0_3(), |
|
98 &KPathSegment_Push0_d(), &KPathSegment_PushPopFront0_4(), |
|
99 &KPathSegment_Push0_e(), &KPathSegment_PushPopFront0_5(), NULL, NULL); |
|
100 |
|
101 TestDelimitedPathSegmentPushBackL(KPathSegment_PushPopBack0_0, &KPathSegment_Push0_a(), &KPathSegment_PushPopBack0_1(), |
|
102 &KPathSegment_Push0_b(), &KPathSegment_PushPopBack0_2(), |
|
103 &KPathSegment_Push0_c(), &KPathSegment_PushPopBack0_3(), |
|
104 &KPathSegment_Push0_d(), &KPathSegment_PushPopBack0_4(), |
|
105 &KPathSegment_Push0_e(), &KPathSegment_PushPopBack0_5(), NULL, NULL); |
|
106 |
|
107 TestDelimitedPathSegmentPopFrontL(KPathSegment_PushPopFront0_5, &KPathSegment_PushPopFront0_4(), &KPathSegment_PushPopFront0_3(), |
|
108 &KPathSegment_PushPopFront0_2(), &KPathSegment_PushPopFront0_1(), &KPathSegment_PushPopFront0_0(), NULL); |
|
109 |
|
110 TestDelimitedPathSegmentPopBackL(KPathSegment_PushPopBack0_5, &KPathSegment_PushPopBack0_4(), &KPathSegment_PushPopBack0_3(), |
|
111 &KPathSegment_PushPopBack0_2(), &KPathSegment_PushPopBack0_1(), &KPathSegment_PushPopBack0_0(), NULL); |
|
112 |
|
113 TestDelimitedPathSegmentAddAndTrimFrontAndBackDelimiterL(KPathSegment_AddTrimDelim0); |
|
114 |
|
115 TestDelimitedPathSegmentInsertAndParseL(KPathSegmentInsertForwardsPos0, KPathSegment_InsertForwards0_0, |
|
116 &KPathSegment_Insert0_a(), &KPathSegment_InsertForwards0_1(), |
|
117 &KPathSegment_Insert0_b(), &KPathSegment_InsertForwards0_2(), |
|
118 &KPathSegment_Insert0_c(), &KPathSegment_InsertForwards0_3(), |
|
119 &KPathSegment_Insert0_d(), &KPathSegment_InsertForwards0_4(), |
|
120 &KPathSegment_Insert0_e(), &KPathSegment_InsertForwards0_5(), NULL, NULL); |
|
121 |
|
122 TestDelimitedPathSegmentRemoveAndParseL(KPathSegmentRemoveForwardsPos0, KPathSegment_RemoveForwards0_0, |
|
123 &KPathSegment_RemoveForwards0_1(), &KPathSegment_RemoveForwards0_2(), |
|
124 &KPathSegment_RemoveForwards0_3(), &KPathSegment_RemoveForwards0_4(), |
|
125 &KPathSegment_RemoveForwards0_5(), NULL); |
|
126 |
|
127 TestDelimitedPathSegmentInsertAndParseReverseL(KPathSegmentInsertBackwardsPos0, KPathSegment_InsertBackwards0_0, |
|
128 &KPathSegment_Insert0_a(), &KPathSegment_InsertBackwards0_1(), |
|
129 &KPathSegment_Insert0_b(), &KPathSegment_InsertBackwards0_2(), |
|
130 &KPathSegment_Insert0_c(), &KPathSegment_InsertBackwards0_3(), |
|
131 &KPathSegment_Insert0_d(), &KPathSegment_InsertBackwards0_4(), |
|
132 &KPathSegment_Insert0_e(), &KPathSegment_InsertBackwards0_5(), NULL, NULL); |
|
133 |
|
134 TestDelimitedPathSegmentRemoveAndParseReverseL(KPathSegmentRemoveBackwardsPos0, KPathSegment_RemoveBackwards0_0, |
|
135 &KPathSegment_RemoveBackwards0_1(), &KPathSegment_RemoveBackwards0_2(), |
|
136 &KPathSegment_RemoveBackwards0_3(), &KPathSegment_RemoveBackwards0_4(), |
|
137 &KPathSegment_RemoveBackwards0_5(), NULL); |
|
138 |
|
139 TestDelimitedPathSegmentInsertEscapeAndParseL(KPathSegmentInsertEscapeForwardsPos0, KPathSegment_InsertEscapeForwards0_0, |
|
140 &KPathSegment_InsertEscape0_a(), &KPathSegment_InsertEscapeForwards0_1(), |
|
141 &KPathSegment_InsertEscape0_b(), &KPathSegment_InsertEscapeForwards0_2(), |
|
142 &KPathSegment_InsertEscape0_c(), &KPathSegment_InsertEscapeForwards0_3(), |
|
143 &KPathSegment_InsertEscape0_d(), &KPathSegment_InsertEscapeForwards0_4(), |
|
144 &KPathSegment_InsertEscape0_e(), &KPathSegment_InsertEscapeForwards0_5(), NULL, NULL); |
|
145 |
|
146 TestDelimitedPathSegmentInsertEscapeAndParseReverseL(KPathSegmentInsertEscapeBackwardsPos0, KPathSegment_InsertEscapeBackwards0_0, |
|
147 &KPathSegment_InsertEscape0_a(), &KPathSegment_InsertEscapeBackwards0_1(), |
|
148 &KPathSegment_InsertEscape0_b(), &KPathSegment_InsertEscapeBackwards0_2(), |
|
149 &KPathSegment_InsertEscape0_c(), &KPathSegment_InsertEscapeBackwards0_3(), |
|
150 &KPathSegment_InsertEscape0_d(), &KPathSegment_InsertEscapeBackwards0_4(), |
|
151 &KPathSegment_InsertEscape0_e(), &KPathSegment_InsertEscapeBackwards0_5(), NULL, NULL); |
|
152 |
|
153 TestDelimitedPathSegmentPushAndEscapeFrontL(KPathSegment_PushEscapeFront0_0, &KPathSegment_PushEscape0_a(), &KPathSegment_PushEscapeFront0_1(), |
|
154 &KPathSegment_PushEscape0_b(), &KPathSegment_PushEscapeFront0_2(), |
|
155 &KPathSegment_PushEscape0_c(), &KPathSegment_PushEscapeFront0_3(), |
|
156 &KPathSegment_PushEscape0_d(), &KPathSegment_PushEscapeFront0_4(), |
|
157 &KPathSegment_PushEscape0_e(), &KPathSegment_PushEscapeFront0_5(), NULL, NULL); |
|
158 |
|
159 TestDelimitedPathSegmentPushAndEscapeBackL(KPathSegment_PushEscapeBack0_0, &KPathSegment_PushEscape0_a(), &KPathSegment_PushEscapeBack0_1(), |
|
160 &KPathSegment_PushEscape0_b(), &KPathSegment_PushEscapeBack0_2(), |
|
161 &KPathSegment_PushEscape0_c(), &KPathSegment_PushEscapeBack0_3(), |
|
162 &KPathSegment_PushEscape0_d(), &KPathSegment_PushEscapeBack0_4(), |
|
163 &KPathSegment_PushEscape0_e(), &KPathSegment_PushEscapeBack0_5(), NULL, NULL); |
|
164 } |
|
165 |
|
166 // |
|
167 // |
|
168 // Delimited PathSegment tests |
|
169 // |
|
170 // |
|
171 |
|
172 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentExtractionL(TRefByValue<const TDesC> aPath, ...) const |
|
173 { |
|
174 VA_LIST list1; VA_START(list1, aPath); |
|
175 VA_LIST list2; VA_START(list2, aPath); |
|
176 const TDesC& path = aPath; |
|
177 |
|
178 TestDelimitedDataExtractionL(_L("Test TDelimitedPathSegmentParser Parse : GetNext, Dec, Inc, Peek and Eos"), iTestHarness, path, list1, list2); |
|
179 VA_END(list1); VA_END(list2); |
|
180 } |
|
181 |
|
182 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentReverseExtractionL(TRefByValue<const TDesC> aPath, ...) const |
|
183 { |
|
184 VA_LIST list1; VA_START(list1, aPath); |
|
185 VA_LIST list2; VA_START(list2, aPath); |
|
186 const TDesC& path = aPath; |
|
187 |
|
188 TestDelimitedDataReverseExtractionL(_L("Test TDelimitedPathSegmentParser ParseReverse : GetNext, Dec, Inc, Peek and Eos"), iTestHarness, path, list1, list2); |
|
189 VA_END(list1); VA_END(list2); |
|
190 } |
|
191 |
|
192 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentDelimiterPresenceL(const TDesC& aPath, TBool aFrontDelim, TBool aBackDelim) const |
|
193 { |
|
194 TestDelimitedDataDelimiterPresenceL(_L("Test TDelimitedPathSegmentParser Delimiter Presence"), iTestHarness, aPath, aFrontDelim, aBackDelim); |
|
195 } |
|
196 |
|
197 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentRemainderL(TRefByValue<const TDesC> aPath, ...) const |
|
198 { |
|
199 VA_LIST list1; VA_START(list1, aPath); |
|
200 VA_LIST list2; VA_START(list2, aPath); |
|
201 const TDesC& path = aPath; |
|
202 |
|
203 TestDelimitedDataRemainderL(_L("Test TDelimitedPathSegmentParser Remainder, Parse"), iTestHarness, path, list1, list2); |
|
204 VA_END(list1); VA_END(list2); |
|
205 } |
|
206 |
|
207 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentRemainderReverseL(TRefByValue<const TDesC> aPath, ...) const |
|
208 { |
|
209 VA_LIST list1; VA_START(list1, aPath); |
|
210 VA_LIST list2; VA_START(list2, aPath); |
|
211 const TDesC& path = aPath; |
|
212 |
|
213 TestDelimitedDataRemainderReverseL(_L("Test TDelimitedPathSegmentParser Remainder, ParseReverse"), iTestHarness, path, list1, list2); |
|
214 VA_END(list1); VA_END(list2); |
|
215 } |
|
216 |
|
217 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentDesL(const TDesC& aPath) const |
|
218 { |
|
219 TestDelimitedDataDesL(_L("Test TDelimitedPathSegmentParser Des"), iTestHarness, aPath); |
|
220 } |
|
221 |
|
222 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentPushFrontL(TRefByValue<const TDesC> aPath, ...) const |
|
223 { |
|
224 VA_LIST list1; VA_START(list1, aPath); |
|
225 VA_LIST list2; VA_START(list2, aPath); |
|
226 const TDesC& path = aPath; |
|
227 |
|
228 TestDelimitedDataPushFrontL(_L("Test CDelimitedPathSegment PushFront"), iTestHarness, path, list1, list2); |
|
229 VA_END(list1); |
|
230 VA_END(list2); |
|
231 } |
|
232 |
|
233 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentPushBackL(TRefByValue<const TDesC> aPath, ...) const |
|
234 { |
|
235 VA_LIST list1; VA_START(list1, aPath); |
|
236 VA_LIST list2; VA_START(list2, aPath); |
|
237 const TDesC& path = aPath; |
|
238 |
|
239 TestDelimitedDataPushBackL(_L("Test CDelimitedPathSegment PushBack"), iTestHarness, path, list1, list2); |
|
240 VA_END(list1); VA_END(list2); |
|
241 } |
|
242 |
|
243 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentPopFrontL(TRefByValue<const TDesC> aPath, ...) const |
|
244 { |
|
245 VA_LIST list1; VA_START(list1, aPath); |
|
246 VA_LIST list2; VA_START(list2, aPath); |
|
247 const TDesC& path = aPath; |
|
248 |
|
249 TestDelimitedDataPopFrontL(_L("Test CDelimitedPathSegment PopFront"), iTestHarness, path, list1, list2); |
|
250 VA_END(list1); VA_END(list2); |
|
251 } |
|
252 |
|
253 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentPopBackL(TRefByValue<const TDesC> aPath, ...) const |
|
254 { |
|
255 VA_LIST list1; VA_START(list1, aPath); |
|
256 VA_LIST list2; VA_START(list2, aPath); |
|
257 const TDesC& path = aPath; |
|
258 |
|
259 TestDelimitedDataPopBackL(_L("Test CDelimitedPathSegment PopBack"), iTestHarness, path, list1, list2); |
|
260 VA_END(list1); VA_END(list2); |
|
261 } |
|
262 |
|
263 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentAddAndTrimFrontAndBackDelimiterL(const TDesC& aPath) const |
|
264 { |
|
265 TestDelimitedDataAddAndTrimFrontAndBackDelimiterL(_L("Test CDelimitedPathSegment Add and Trim Front and Back delimiter"), iTestHarness, aPath); |
|
266 } |
|
267 |
|
268 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentInsertAndParseL(TInt aStartPos, TRefByValue<const TDesC> aPath, ...) const |
|
269 { |
|
270 VA_LIST list1; VA_START(list1, aPath); |
|
271 VA_LIST list2; VA_START(list2, aPath); |
|
272 const TDesC& path = aPath; |
|
273 |
|
274 TestDelimitedDataInsertAndParseL(_L("Test CDelimitedPathSegment InsertCurrent, Parse"), iTestHarness, path, list1, list2, aStartPos); |
|
275 VA_END(list1); VA_END(list2); |
|
276 } |
|
277 |
|
278 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentRemoveAndParseL(TInt aStartPos, TRefByValue<const TDesC> aPath, ...) const |
|
279 { |
|
280 VA_LIST list1; VA_START(list1, aPath); |
|
281 VA_LIST list2; VA_START(list2, aPath); |
|
282 const TDesC& path = aPath; |
|
283 |
|
284 TestDelimitedDataRemoveAndParseL(_L("Test CDelimitedPathSegment RemoveCurrent, Parse"), iTestHarness, path, list1, list2, aStartPos); |
|
285 VA_END(list1); VA_END(list2); |
|
286 } |
|
287 |
|
288 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentInsertAndParseReverseL(TInt aStartPos, TRefByValue<const TDesC> aPath, ...) const |
|
289 { |
|
290 VA_LIST list1; VA_START(list1, aPath); |
|
291 VA_LIST list2; VA_START(list2, aPath); |
|
292 const TDesC& path = aPath; |
|
293 |
|
294 TestDelimitedDataInsertAndParseReverseL(_L("Test CDelimitedPathSegment InsertCurrent, ParseReverse"), iTestHarness, path, list1, list2, aStartPos); |
|
295 VA_END(list1); VA_END(list2); |
|
296 } |
|
297 |
|
298 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentRemoveAndParseReverseL(TInt aStartPos, TRefByValue<const TDesC> aPath, ...) const |
|
299 { |
|
300 VA_LIST list1; VA_START(list1, aPath); |
|
301 VA_LIST list2; VA_START(list2, aPath); |
|
302 const TDesC& path = aPath; |
|
303 |
|
304 TestDelimitedDataRemoveAndParseReverseL(_L("Test CDelimitedPathSegment RemoveCurrent, ParseReverse"), iTestHarness, path, list1, list2, aStartPos); |
|
305 VA_END(list1); VA_END(list2); |
|
306 } |
|
307 |
|
308 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentInsertEscapeAndParseL(TInt aStartPos, TRefByValue<const TDesC> aPath, ...) const |
|
309 { |
|
310 VA_LIST list1; VA_START(list1, aPath); |
|
311 VA_LIST list2; VA_START(list2, aPath); |
|
312 const TDesC& path = aPath; |
|
313 |
|
314 TestDelimitedDataInsertEscapeAndParseL(_L("Test CDelimitedPathSegment InsertAndEscapeCurrent, Parse"), iTestHarness, path, list1, list2, aStartPos); |
|
315 VA_END(list1); VA_END(list2); |
|
316 } |
|
317 |
|
318 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentInsertEscapeAndParseReverseL(TInt aStartPos, TRefByValue<const TDesC> aPath, ...) const |
|
319 { |
|
320 VA_LIST list1; VA_START(list1, aPath); |
|
321 VA_LIST list2; VA_START(list2, aPath); |
|
322 const TDesC& path = aPath; |
|
323 |
|
324 TestDelimitedDataInsertEscapeAndParseReverseL(_L("Test CDelimitedPathSegment InsertAndEscapeCurrent, ParseReverse"), iTestHarness, path, list1, list2, aStartPos); |
|
325 VA_END(list1); VA_END(list2); |
|
326 } |
|
327 |
|
328 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentPushAndEscapeFrontL(TRefByValue<const TDesC> aPath, ...) const |
|
329 { |
|
330 VA_LIST list1; VA_START(list1, aPath); |
|
331 VA_LIST list2; VA_START(list2, aPath); |
|
332 const TDesC& path = aPath; |
|
333 |
|
334 TestDelimitedDataPushAndEscapeFrontL(_L("Test CDelimitedPathSegment PushAndEscapeFront"), iTestHarness, path, list1, list2); |
|
335 VA_END(list1); VA_END(list2); |
|
336 } |
|
337 |
|
338 void CDelimitedPathSegmentTest::TestDelimitedPathSegmentPushAndEscapeBackL(TRefByValue<const TDesC> aPath, ...) const |
|
339 { |
|
340 VA_LIST list1; VA_START(list1, aPath); |
|
341 VA_LIST list2; VA_START(list2, aPath); |
|
342 const TDesC& path = aPath; |
|
343 |
|
344 TestDelimitedDataPushAndEscapeBackL(_L("Test CDelimitedPathSegment PushAndEscapeBack"), iTestHarness, path, list1, list2); |
|
345 VA_END(list1); VA_END(list2); |
|
346 } |
|
347 // |
|
348 // |
|
349 // Implementation of LOCAL functions - test funcions |
|
350 // |
|
351 // |
|
352 |
|
353 void TestDelimitedDataExtractionL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
354 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2) { |
|
355 // Create title |
|
356 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
357 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
358 aTestHarness->StartTestL(*title16Bit); |
|
359 |
|
360 // Create TDelimitedPathSegmentParser object and do parsing |
|
361 TDelimitedPathSegmentParser16 parser16Bit; |
|
362 parser16Bit.Parse(aData); |
|
363 |
|
364 TInt error = DoDelimitedDataParsingL<HBufC16, TPtrC16>(parser16Bit, aList1); |
|
365 |
|
366 CleanupStack::PopAndDestroy(title16Bit); // title16Bit |
|
367 aTestHarness->EndTest(error); |
|
368 |
|
369 // Make 8-bit copy |
|
370 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
371 TPtr8 data8Bit = dataBuf->Des(); |
|
372 data8Bit.Copy(aData); |
|
373 |
|
374 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
375 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
376 aTestHarness->StartTestL(*title8Bit); |
|
377 |
|
378 // Create TDelimitedPathSegmentParser object and do parsing |
|
379 TDelimitedPathSegmentParser8 parser8Bit; |
|
380 parser8Bit.Parse(data8Bit); |
|
381 |
|
382 error = DoDelimitedDataParsingL<HBufC8, TPtrC8>(parser8Bit, aList2); |
|
383 |
|
384 aTestHarness->EndTest(error); |
|
385 CleanupStack::PopAndDestroy(2, dataBuf); // dataBuf, title8Bit |
|
386 } |
|
387 |
|
388 void TestDelimitedDataReverseExtractionL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
389 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2) |
|
390 { |
|
391 // Create title |
|
392 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
393 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
394 aTestHarness->StartTestL(*title16Bit); |
|
395 |
|
396 // Create TDelimitedPathSegmentParser object and do parsing |
|
397 TDelimitedPathSegmentParser16 parser16Bit; |
|
398 parser16Bit.ParseReverse(aData); |
|
399 |
|
400 TInt error = DoDelimitedDataParsingL<HBufC16, TPtrC16>(parser16Bit, aList1); |
|
401 |
|
402 CleanupStack::PopAndDestroy(title16Bit); // title16Bit |
|
403 aTestHarness->EndTest(error); |
|
404 |
|
405 // Make 8-bit copy |
|
406 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
407 TPtr8 data8Bit = dataBuf->Des(); |
|
408 data8Bit.Copy(aData); |
|
409 |
|
410 // Create title |
|
411 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
412 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
413 aTestHarness->StartTestL(*title8Bit); |
|
414 |
|
415 // Create TDelimitedPathSegmentParser object and do parsing |
|
416 TDelimitedPathSegmentParser8 parser8Bit; |
|
417 parser8Bit.ParseReverse(data8Bit); |
|
418 |
|
419 error = DoDelimitedDataParsingL<HBufC8, TPtrC8>(parser8Bit, aList2); |
|
420 |
|
421 aTestHarness->EndTest(error); |
|
422 CleanupStack::PopAndDestroy(2, dataBuf); // dataBuf, title8Bit |
|
423 } |
|
424 |
|
425 void TestDelimitedDataDelimiterPresenceL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
426 const TDesC& aData, TBool aFrontDelim, TBool aBackDelim) |
|
427 { |
|
428 // Create title |
|
429 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
430 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
431 aTestHarness->StartTestL(*title16Bit); |
|
432 |
|
433 // Create TDelimitedPathSegmentParser object |
|
434 TDelimitedPathSegmentParser16 parser16Bit; |
|
435 parser16Bit.Parse(aData); |
|
436 TInt error = DoDelimiterPresenceTest(parser16Bit, aFrontDelim, aBackDelim); |
|
437 |
|
438 CleanupStack::PopAndDestroy(title16Bit); // title16Bit |
|
439 aTestHarness->EndTest(error); |
|
440 |
|
441 // Make 8-bit copy |
|
442 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
443 TPtr8 data8Bit = dataBuf->Des(); |
|
444 data8Bit.Copy(aData); |
|
445 |
|
446 // Create title |
|
447 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
448 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
449 aTestHarness->StartTestL(*title8Bit); |
|
450 |
|
451 // Create TDelimitedPathSegmentParser object |
|
452 TDelimitedPathSegmentParser8 parser8Bit; |
|
453 parser8Bit.Parse(data8Bit); |
|
454 error = DoDelimiterPresenceTest(parser8Bit, aFrontDelim, aBackDelim); |
|
455 |
|
456 aTestHarness->EndTest(error); |
|
457 CleanupStack::PopAndDestroy(2, dataBuf); // dataBuf, title8Bit |
|
458 } |
|
459 |
|
460 void TestDelimitedDataRemainderL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
461 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2) |
|
462 { |
|
463 // Create title |
|
464 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
465 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
466 aTestHarness->StartTestL(*title16Bit); |
|
467 |
|
468 // Create TDelimiteddataParser object and do parsing |
|
469 TDelimitedPathSegmentParser16 parser16Bit; |
|
470 parser16Bit.Parse(aData); |
|
471 |
|
472 TInt error = DoDelimitedDataRemainderTestL<HBufC16, TPtrC16>(parser16Bit, aList1); |
|
473 |
|
474 CleanupStack::PopAndDestroy(title16Bit); // title16Bit |
|
475 aTestHarness->EndTest(error); |
|
476 |
|
477 // Make 8-bit copy |
|
478 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
479 TPtr8 data8Bit = dataBuf->Des(); |
|
480 data8Bit.Copy(aData); |
|
481 |
|
482 // Create title |
|
483 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
484 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
485 aTestHarness->StartTestL(*title8Bit); |
|
486 |
|
487 // Create TDelimiteddataParser object and do parsing |
|
488 TDelimitedPathSegmentParser8 parser8Bit; |
|
489 parser8Bit.Parse(data8Bit); |
|
490 |
|
491 error = DoDelimitedDataRemainderTestL<HBufC8, TPtrC8>(parser8Bit, aList2); |
|
492 |
|
493 aTestHarness->EndTest(error); |
|
494 CleanupStack::PopAndDestroy(2, dataBuf); // dataBuf, title8Bit |
|
495 } |
|
496 |
|
497 void TestDelimitedDataRemainderReverseL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
498 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2) |
|
499 { |
|
500 // Create title |
|
501 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
502 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
503 aTestHarness->StartTestL(*title16Bit); |
|
504 |
|
505 // Create TDelimitedPathSegmentParser object and do parsing |
|
506 TDelimitedPathSegmentParser16 parser16Bit; |
|
507 parser16Bit.ParseReverse(aData); |
|
508 |
|
509 TInt error = DoDelimitedDataRemainderTestL<HBufC16, TPtrC16>(parser16Bit, aList1); |
|
510 |
|
511 CleanupStack::PopAndDestroy(title16Bit); // title16Bit |
|
512 aTestHarness->EndTest(error); |
|
513 |
|
514 // Make 8-bit copy |
|
515 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
516 TPtr8 data8Bit = dataBuf->Des(); |
|
517 data8Bit.Copy(aData); |
|
518 |
|
519 // Create title |
|
520 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
521 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
522 aTestHarness->StartTestL(*title8Bit); |
|
523 |
|
524 // Create TDelimitedPathSegmentParser object and do parsing |
|
525 TDelimitedPathSegmentParser8 parser8Bit; |
|
526 parser8Bit.ParseReverse(data8Bit); |
|
527 |
|
528 error = DoDelimitedDataRemainderTestL<HBufC8, TPtrC8>(parser8Bit, aList2); |
|
529 |
|
530 aTestHarness->EndTest(error); |
|
531 CleanupStack::PopAndDestroy(2, dataBuf); // dataBuf, title8Bit |
|
532 } |
|
533 |
|
534 void TestDelimitedDataDesL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, const TDesC& aData) |
|
535 { |
|
536 // Create title |
|
537 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
538 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
539 aTestHarness->StartTestL(*title16Bit); |
|
540 |
|
541 // Create TDelimitedPathSegmentParser object and do parsing |
|
542 TDelimitedPathSegmentParser16 parser16Bit; |
|
543 parser16Bit.Parse(aData); |
|
544 |
|
545 TInt error = DoDelimitedDataDes(parser16Bit, aData); |
|
546 |
|
547 CleanupStack::PopAndDestroy(title16Bit); // title16Bit |
|
548 aTestHarness->EndTest(error); |
|
549 |
|
550 // Make 8-bit copy |
|
551 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
552 TPtr8 data8Bit = dataBuf->Des(); |
|
553 data8Bit.Copy(aData); |
|
554 |
|
555 // Create title |
|
556 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
557 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
558 aTestHarness->StartTestL(*title8Bit); |
|
559 |
|
560 // Create TDelimitedPathSegmentParser object and do parsing |
|
561 TDelimitedPathSegmentParser8 parser8Bit; |
|
562 parser8Bit.Parse(data8Bit); |
|
563 |
|
564 error = DoDelimitedDataDes(parser8Bit, data8Bit); |
|
565 |
|
566 aTestHarness->EndTest(error); |
|
567 CleanupStack::PopAndDestroy(2, dataBuf); // dataBuf, title8Bit |
|
568 } |
|
569 |
|
570 void TestDelimitedDataPushFrontL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
571 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2) |
|
572 { |
|
573 // Create title |
|
574 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
575 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
576 aTestHarness->StartTestL(*title16Bit); |
|
577 |
|
578 // Create TDelimitedPathSegmentParser object and do parsing |
|
579 CDelimitedPathSegment16* data16Bit = CDelimitedPathSegment16::NewL(aData); // Also excersies NewLC() |
|
580 CleanupStack::PushL(data16Bit); |
|
581 |
|
582 TInt error = DoDelimitedDataPushFrontL<HBufC16>(data16Bit, aList1); |
|
583 |
|
584 CleanupStack::PopAndDestroy(2, title16Bit); // title16Bit, data16Bit |
|
585 aTestHarness->EndTest(error); |
|
586 |
|
587 // Make 8-bit copy |
|
588 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
589 TPtr8 initData8Bit = dataBuf->Des(); |
|
590 initData8Bit.Copy(aData); |
|
591 |
|
592 // Create title |
|
593 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
594 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
595 aTestHarness->StartTestL(*title8Bit); |
|
596 |
|
597 // Create TDelimitedPathSegmentParser object and do parsing |
|
598 CDelimitedPathSegment8* data8Bit = CDelimitedPathSegment8::NewL(initData8Bit); // Also excersies NewLC() |
|
599 CleanupStack::PushL(data8Bit); |
|
600 |
|
601 error = DoDelimitedDataPushFrontL<HBufC8>(data8Bit, aList2); |
|
602 |
|
603 aTestHarness->EndTest(error); |
|
604 CleanupStack::PopAndDestroy(3, dataBuf); // dataBuf, title8Bit, data8Bit |
|
605 } |
|
606 |
|
607 void TestDelimitedDataPushAndEscapeFrontL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
608 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2) |
|
609 { |
|
610 // Create title |
|
611 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
612 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
613 aTestHarness->StartTestL(*title16Bit); |
|
614 |
|
615 // Create TDelimitedPathSegmentParser object and do parsing |
|
616 CDelimitedPathSegment16* data16Bit = CDelimitedPathSegment16::NewL(aData); // Also excersies NewLC() |
|
617 CleanupStack::PushL(data16Bit); |
|
618 |
|
619 TInt error = DoDelimitedDataPushAndEscapeFrontL<HBufC16>(data16Bit, aList1); |
|
620 |
|
621 CleanupStack::PopAndDestroy(2, title16Bit); // title16Bit, data16Bit |
|
622 aTestHarness->EndTest(error); |
|
623 |
|
624 // Make 8-bit copy |
|
625 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
626 TPtr8 initData8Bit = dataBuf->Des(); |
|
627 initData8Bit.Copy(aData); |
|
628 |
|
629 // Create title |
|
630 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
631 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
632 aTestHarness->StartTestL(*title8Bit); |
|
633 |
|
634 // Create TDelimitedPathSegmentParser object and do parsing |
|
635 CDelimitedPathSegment8* data8Bit = CDelimitedPathSegment8::NewL(initData8Bit); // Also excersies NewLC() |
|
636 CleanupStack::PushL(data8Bit); |
|
637 |
|
638 error = DoDelimitedDataPushAndEscapeFrontL<HBufC8>(data8Bit, aList2); |
|
639 |
|
640 aTestHarness->EndTest(error); |
|
641 CleanupStack::PopAndDestroy(3, dataBuf); // dataBuf, title8Bit, data8Bit |
|
642 } |
|
643 |
|
644 void TestDelimitedDataPushBackL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
645 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2) |
|
646 { |
|
647 // Create title |
|
648 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
649 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
650 aTestHarness->StartTestL(*title16Bit); |
|
651 |
|
652 // Create TDelimitedPathSegmentParser object and do parsing |
|
653 CDelimitedPathSegment16* data16Bit = CDelimitedPathSegment16::NewL(aData); // Also excersies NewLC() |
|
654 CleanupStack::PushL(data16Bit); |
|
655 |
|
656 TInt error = DoDelimitedDataPushBackL<HBufC16>(data16Bit, aList1); |
|
657 |
|
658 CleanupStack::PopAndDestroy(2, title16Bit); // title16Bit, data16Bit |
|
659 aTestHarness->EndTest(error); |
|
660 |
|
661 // Make 8-bit copy |
|
662 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
663 TPtr8 initData8Bit = dataBuf->Des(); |
|
664 initData8Bit.Copy(aData); |
|
665 |
|
666 // Create title |
|
667 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
668 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
669 aTestHarness->StartTestL(*title8Bit); |
|
670 |
|
671 // Create TDelimitedPathSegmentParser object and do parsing |
|
672 CDelimitedPathSegment8* data8Bit = CDelimitedPathSegment8::NewL(initData8Bit); // Also excersies NewLC() |
|
673 CleanupStack::PushL(data8Bit); |
|
674 |
|
675 error = DoDelimitedDataPushBackL<HBufC8>(data8Bit, aList2); |
|
676 |
|
677 aTestHarness->EndTest(error); |
|
678 CleanupStack::PopAndDestroy(3, dataBuf); // dataBuf, title8Bit, data8Bit |
|
679 } |
|
680 |
|
681 void TestDelimitedDataPushAndEscapeBackL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
682 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2) |
|
683 { |
|
684 // Create title |
|
685 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
686 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
687 aTestHarness->StartTestL(*title16Bit); |
|
688 |
|
689 // Create TDelimitedPathSegmentParser object and do parsing |
|
690 CDelimitedPathSegment16* data16Bit = CDelimitedPathSegment16::NewL(aData); // Also excersies NewLC() |
|
691 CleanupStack::PushL(data16Bit); |
|
692 |
|
693 TInt error = DoDelimitedDataPushAndEscapeBackL<HBufC16>(data16Bit, aList1); |
|
694 |
|
695 CleanupStack::PopAndDestroy(2, title16Bit); // title16Bit, data16Bit |
|
696 aTestHarness->EndTest(error); |
|
697 |
|
698 // Make 8-bit copy |
|
699 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
700 TPtr8 initData8Bit = dataBuf->Des(); |
|
701 initData8Bit.Copy(aData); |
|
702 |
|
703 // Create title |
|
704 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
705 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
706 aTestHarness->StartTestL(*title8Bit); |
|
707 |
|
708 // Create TDelimitedPathSegmentParser object and do parsing |
|
709 CDelimitedPathSegment8* data8Bit = CDelimitedPathSegment8::NewL(initData8Bit); // Also excersies NewLC() |
|
710 CleanupStack::PushL(data8Bit); |
|
711 |
|
712 error = DoDelimitedDataPushAndEscapeBackL<HBufC8>(data8Bit, aList2); |
|
713 |
|
714 aTestHarness->EndTest(error); |
|
715 CleanupStack::PopAndDestroy(3, dataBuf); // dataBuf, title8Bit, data8Bit |
|
716 } |
|
717 |
|
718 void TestDelimitedDataPopFrontL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
719 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2) |
|
720 { |
|
721 // Create title |
|
722 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
723 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
724 aTestHarness->StartTestL(*title16Bit); |
|
725 |
|
726 // Create TDelimitedPathSegmentParser object and do parsing |
|
727 CDelimitedPathSegment16* data16Bit = CDelimitedPathSegment16::NewL(aData); // Also excersies NewLC() |
|
728 CleanupStack::PushL(data16Bit); |
|
729 |
|
730 TInt error = DoDelimitedDataPopFrontL<HBufC16>(data16Bit, aList1); |
|
731 |
|
732 CleanupStack::PopAndDestroy(2, title16Bit); // title16Bit, data16Bit |
|
733 aTestHarness->EndTest(error); |
|
734 |
|
735 // Make 8-bit copy |
|
736 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
737 TPtr8 initData8Bit = dataBuf->Des(); |
|
738 initData8Bit.Copy(aData); |
|
739 |
|
740 // Create title |
|
741 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
742 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
743 aTestHarness->StartTestL(*title8Bit); |
|
744 |
|
745 // Create TDelimitedPathSegmentParser object and do parsing |
|
746 CDelimitedPathSegment8* data8Bit = CDelimitedPathSegment8::NewL(initData8Bit); // Also excersies NewLC() |
|
747 CleanupStack::PushL(data8Bit); |
|
748 |
|
749 error = DoDelimitedDataPopFrontL<HBufC8>(data8Bit, aList2); |
|
750 |
|
751 aTestHarness->EndTest(error); |
|
752 CleanupStack::PopAndDestroy(3, dataBuf); // dataBuf, title8Bit, data8Bit |
|
753 } |
|
754 |
|
755 void TestDelimitedDataPopBackL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
756 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2) |
|
757 { |
|
758 // Create title |
|
759 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
760 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
761 aTestHarness->StartTestL(*title16Bit); |
|
762 |
|
763 // Create TDelimitedPathSegmentParser object and do parsing |
|
764 CDelimitedPathSegment16* data16Bit = CDelimitedPathSegment16::NewL(aData); // Also excersies NewLC() |
|
765 CleanupStack::PushL(data16Bit); |
|
766 |
|
767 TInt error = DoDelimitedDataPopBackL<HBufC16>(data16Bit, aList1); |
|
768 |
|
769 CleanupStack::PopAndDestroy(2, title16Bit); // title16Bit, data16Bit |
|
770 aTestHarness->EndTest(error); |
|
771 |
|
772 // Make 8-bit copy |
|
773 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
774 TPtr8 initData8Bit = dataBuf->Des(); |
|
775 initData8Bit.Copy(aData); |
|
776 |
|
777 // Create title |
|
778 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
779 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
780 aTestHarness->StartTestL(*title8Bit); |
|
781 |
|
782 // Create TDelimitedPathSegmentParser object and do parsing |
|
783 CDelimitedPathSegment8* data8Bit = CDelimitedPathSegment8::NewL(initData8Bit); // Also excersies NewLC() |
|
784 CleanupStack::PushL(data8Bit); |
|
785 |
|
786 error = DoDelimitedDataPopBackL<HBufC8>(data8Bit, aList2); |
|
787 |
|
788 aTestHarness->EndTest(error); |
|
789 CleanupStack::PopAndDestroy(3, dataBuf); // dataBuf, title8Bit, data8Bit |
|
790 } |
|
791 |
|
792 void TestDelimitedDataAddAndTrimFrontAndBackDelimiterL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, const TDesC& aData) |
|
793 { |
|
794 // Create title |
|
795 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
796 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
797 aTestHarness->StartTestL(*title16Bit); |
|
798 |
|
799 // Create TDelimitedPathSegmentParser object and do parsing |
|
800 CDelimitedPathSegment16* data16Bit = CDelimitedPathSegment16::NewL(aData); // Also excersies NewLC() |
|
801 CleanupStack::PushL(data16Bit); |
|
802 |
|
803 TInt error = DoDelimitedDataAddAndTrimFrontAndBackDelimiterL(data16Bit); |
|
804 |
|
805 CleanupStack::PopAndDestroy(2, title16Bit); // title16Bit, data16Bit |
|
806 aTestHarness->EndTest(error); |
|
807 |
|
808 // Make 8-bit copy |
|
809 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
810 TPtr8 initData8Bit = dataBuf->Des(); |
|
811 initData8Bit.Copy(aData); |
|
812 |
|
813 // Create title |
|
814 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
815 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
816 aTestHarness->StartTestL(*title8Bit); |
|
817 |
|
818 // Create TDelimitedPathSegmentParser object and do parsing |
|
819 CDelimitedPathSegment8* data8Bit = CDelimitedPathSegment8::NewL(initData8Bit); // Also excersies NewLC() |
|
820 CleanupStack::PushL(data8Bit); |
|
821 |
|
822 error = DoDelimitedDataAddAndTrimFrontAndBackDelimiterL(data8Bit); |
|
823 |
|
824 aTestHarness->EndTest(error); |
|
825 CleanupStack::PopAndDestroy(3, dataBuf); // dataBuf, title8Bit, data8Bit |
|
826 } |
|
827 |
|
828 void TestDelimitedDataInsertAndParseL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
829 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2, TInt aStartPos) |
|
830 { |
|
831 // Create title |
|
832 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
833 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
834 aTestHarness->StartTestL(*title16Bit); |
|
835 |
|
836 // Create TDelimitedPathSegmentParser object and do parsing |
|
837 CDelimitedPathSegment16* data16Bit = CDelimitedPathSegment16::NewL(aData); // Also excersies NewLC() |
|
838 CleanupStack::PushL(data16Bit); |
|
839 |
|
840 // Do initial parse and get to position |
|
841 data16Bit->Parse(); |
|
842 TInt error = DoDelimitedDataParseToPosition(data16Bit, aStartPos); |
|
843 if( error == KErrNone ) |
|
844 { |
|
845 error = DoDelimitedDataInsertL<HBufC16, TPtrC16>(data16Bit, aList1); |
|
846 } |
|
847 CleanupStack::PopAndDestroy(2, title16Bit); // title16Bit, data16Bit |
|
848 aTestHarness->EndTest(error); |
|
849 |
|
850 // Make 8-bit copy |
|
851 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
852 TPtr8 initData8Bit = dataBuf->Des(); |
|
853 initData8Bit.Copy(aData); |
|
854 |
|
855 // Create title |
|
856 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
857 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
858 aTestHarness->StartTestL(*title8Bit); |
|
859 |
|
860 // Create TDelimitedPathSegmentParser object and do parsing |
|
861 CDelimitedPathSegment8* data8Bit = CDelimitedPathSegment8::NewL(initData8Bit); // Also excersies NewLC() |
|
862 CleanupStack::PushL(data8Bit); |
|
863 |
|
864 // Do initial parse and get to position |
|
865 data8Bit->Parse(); |
|
866 error = DoDelimitedDataParseToPosition(data8Bit, aStartPos); |
|
867 if( error == KErrNone ) |
|
868 { |
|
869 error = DoDelimitedDataInsertL<HBufC8, TPtrC8>(data8Bit, aList2); |
|
870 } |
|
871 aTestHarness->EndTest(error); |
|
872 CleanupStack::PopAndDestroy(3, dataBuf); // dataBuf, title8Bit, data8Bit |
|
873 } |
|
874 |
|
875 void TestDelimitedDataRemoveAndParseL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
876 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2, TInt aStartPos) |
|
877 { |
|
878 // Create title |
|
879 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
880 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
881 aTestHarness->StartTestL(*title16Bit); |
|
882 |
|
883 // Create TDelimitedPathSegmentParser object and do parsing |
|
884 CDelimitedPathSegment16* data16Bit = CDelimitedPathSegment16::NewL(aData); // Also excersies NewLC() |
|
885 CleanupStack::PushL(data16Bit); |
|
886 |
|
887 // Do initial parse and get to position |
|
888 data16Bit->Parse(); |
|
889 TInt error = DoDelimitedDataParseToPosition(data16Bit, aStartPos); |
|
890 if( error == KErrNone ) |
|
891 { |
|
892 error = DoDelimitedDataRemoveL<HBufC16, TPtrC16>(data16Bit, aList1); |
|
893 } |
|
894 CleanupStack::PopAndDestroy(2, title16Bit); // title16Bit, data16Bit |
|
895 aTestHarness->EndTest(error); |
|
896 |
|
897 // Make 8-bit copy |
|
898 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
899 TPtr8 initData8Bit = dataBuf->Des(); |
|
900 initData8Bit.Copy(aData); |
|
901 |
|
902 // Create title |
|
903 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
904 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
905 aTestHarness->StartTestL(*title8Bit); |
|
906 |
|
907 // Create TDelimitedPathSegmentParser object and do parsing |
|
908 CDelimitedPathSegment8* data8Bit = CDelimitedPathSegment8::NewL(initData8Bit); // Also excersies NewLC() |
|
909 CleanupStack::PushL(data8Bit); |
|
910 |
|
911 // Do initial parse and get to position |
|
912 data8Bit->Parse(); |
|
913 error = DoDelimitedDataParseToPosition(data8Bit, aStartPos); |
|
914 if( error == KErrNone ) |
|
915 { |
|
916 error = DoDelimitedDataRemoveL<HBufC8, TPtrC8>(data8Bit, aList2); |
|
917 } |
|
918 aTestHarness->EndTest(error); |
|
919 CleanupStack::PopAndDestroy(3, dataBuf); // dataBuf, title8Bit, data8Bit |
|
920 } |
|
921 |
|
922 void TestDelimitedDataInsertAndParseReverseL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
923 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2, TInt aStartPos) |
|
924 { |
|
925 // Create title |
|
926 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
927 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
928 aTestHarness->StartTestL(*title16Bit); |
|
929 |
|
930 // Create TDelimitedPathSegmentParser object and do parsing |
|
931 CDelimitedPathSegment16* data16Bit = CDelimitedPathSegment16::NewL(aData); // Also excersies NewLC() |
|
932 CleanupStack::PushL(data16Bit); |
|
933 |
|
934 // Do initial parse and get to position |
|
935 data16Bit->ParseReverse(); |
|
936 TInt error = DoDelimitedDataParseToPosition(data16Bit, aStartPos); |
|
937 if( error == KErrNone ) |
|
938 { |
|
939 error = DoDelimitedDataInsertL<HBufC16, TPtrC16>(data16Bit, aList1); |
|
940 } |
|
941 CleanupStack::PopAndDestroy(2, title16Bit); // title16Bit, data16Bit |
|
942 aTestHarness->EndTest(error); |
|
943 |
|
944 // Make 8-bit copy |
|
945 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
946 TPtr8 initData8Bit = dataBuf->Des(); |
|
947 initData8Bit.Copy(aData); |
|
948 |
|
949 // Create title |
|
950 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
951 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
952 aTestHarness->StartTestL(*title8Bit); |
|
953 |
|
954 // Create TDelimitedPathSegmentParser object and do parsing |
|
955 CDelimitedPathSegment8* data8Bit = CDelimitedPathSegment8::NewL(initData8Bit); // Also excersies NewLC() |
|
956 CleanupStack::PushL(data8Bit); |
|
957 |
|
958 // Do initial parse and get to position |
|
959 data8Bit->ParseReverse(); |
|
960 error = DoDelimitedDataParseToPosition(data8Bit, aStartPos); |
|
961 if( error == KErrNone ) |
|
962 { |
|
963 error = DoDelimitedDataInsertL<HBufC8, TPtrC8>(data8Bit, aList2); |
|
964 } |
|
965 aTestHarness->EndTest(error); |
|
966 CleanupStack::PopAndDestroy(3, dataBuf); // dataBuf, title8Bit, data8Bit |
|
967 } |
|
968 |
|
969 void TestDelimitedDataRemoveAndParseReverseL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
970 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2, TInt aStartPos) |
|
971 { |
|
972 // Create title |
|
973 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
974 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
975 aTestHarness->StartTestL(*title16Bit); |
|
976 |
|
977 // Create TDelimitedPathSegmentParser object and do parsing |
|
978 CDelimitedPathSegment16* data16Bit = CDelimitedPathSegment16::NewL(aData); // Also excersies NewLC() |
|
979 CleanupStack::PushL(data16Bit); |
|
980 |
|
981 // Do initial parse and get to position |
|
982 data16Bit->ParseReverse(); |
|
983 TInt error = DoDelimitedDataParseToPosition(data16Bit, aStartPos); |
|
984 if( error == KErrNone ) |
|
985 { |
|
986 error = DoDelimitedDataRemoveL<HBufC16, TPtrC16>(data16Bit, aList1); |
|
987 } |
|
988 CleanupStack::PopAndDestroy(2, title16Bit); // title16Bit, data16Bit |
|
989 aTestHarness->EndTest(error); |
|
990 |
|
991 // Make 8-bit copy |
|
992 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
993 TPtr8 initData8Bit = dataBuf->Des(); |
|
994 initData8Bit.Copy(aData); |
|
995 |
|
996 // Create title |
|
997 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
998 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
999 aTestHarness->StartTestL(*title8Bit); |
|
1000 |
|
1001 // Create TDelimitedPathSegmentParser object and do parsing |
|
1002 CDelimitedPathSegment8* data8Bit = CDelimitedPathSegment8::NewL(initData8Bit); // Also excersies NewLC() |
|
1003 CleanupStack::PushL(data8Bit); |
|
1004 |
|
1005 // Do initial parse and get to position |
|
1006 data8Bit->ParseReverse(); |
|
1007 error = DoDelimitedDataParseToPosition(data8Bit, aStartPos); |
|
1008 if( error == KErrNone ) |
|
1009 { |
|
1010 error = DoDelimitedDataRemoveL<HBufC8, TPtrC8>(data8Bit, aList2); |
|
1011 } |
|
1012 aTestHarness->EndTest(error); |
|
1013 CleanupStack::PopAndDestroy(3, dataBuf); // dataBuf, title8Bit, data8Bit |
|
1014 } |
|
1015 |
|
1016 void TestDelimitedDataInsertEscapeAndParseL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
1017 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2, TInt aStartPos) |
|
1018 { |
|
1019 // Create title |
|
1020 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
1021 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
1022 aTestHarness->StartTestL(*title16Bit); |
|
1023 |
|
1024 // Create TDelimitedPathSegmentParser object and do parsing |
|
1025 CDelimitedPathSegment16* data16Bit = CDelimitedPathSegment16::NewL(aData); // Also excersies NewLC() |
|
1026 CleanupStack::PushL(data16Bit); |
|
1027 |
|
1028 // Do initial parse and get to position |
|
1029 data16Bit->Parse(); |
|
1030 TInt error = DoDelimitedDataParseToPosition(data16Bit, aStartPos); |
|
1031 if( error == KErrNone ) |
|
1032 { |
|
1033 error = DoDelimitedDataInsertAndEscapeL<HBufC16, TPtrC16>(data16Bit, aList1); |
|
1034 } |
|
1035 CleanupStack::PopAndDestroy(2, title16Bit); // title16Bit, data16Bit |
|
1036 aTestHarness->EndTest(error); |
|
1037 |
|
1038 // Make 8-bit copy |
|
1039 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
1040 TPtr8 initData8Bit = dataBuf->Des(); |
|
1041 initData8Bit.Copy(aData); |
|
1042 |
|
1043 // Create title |
|
1044 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
1045 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
1046 aTestHarness->StartTestL(*title8Bit); |
|
1047 |
|
1048 // Create TDelimitedPathSegmentParser object and do parsing |
|
1049 CDelimitedPathSegment8* data8Bit = CDelimitedPathSegment8::NewL(initData8Bit); // Also excersies NewLC() |
|
1050 CleanupStack::PushL(data8Bit); |
|
1051 |
|
1052 // Do initial parse and get to position |
|
1053 data8Bit->Parse(); |
|
1054 error = DoDelimitedDataParseToPosition(data8Bit, aStartPos); |
|
1055 if( error == KErrNone ) |
|
1056 { |
|
1057 error = DoDelimitedDataInsertAndEscapeL<HBufC8, TPtrC8>(data8Bit, aList2); |
|
1058 } |
|
1059 aTestHarness->EndTest(error); |
|
1060 CleanupStack::PopAndDestroy(3, dataBuf); // dataBuf, title8Bit, data8Bit |
|
1061 } |
|
1062 |
|
1063 void TestDelimitedDataInsertEscapeAndParseReverseL(const TDesC& aTestTitle, CIpuTestHarness* aTestHarness, |
|
1064 const TDesC& aData, VA_LIST& aList1, VA_LIST& aList2, TInt aStartPos) |
|
1065 { |
|
1066 // Create title |
|
1067 HBufC* title16Bit = HBufC::NewLC(aTestTitle.Length() + KTitle16Bit().Length()); |
|
1068 title16Bit->Des().Format(KTitle16Bit, &aTestTitle); |
|
1069 aTestHarness->StartTestL(*title16Bit); |
|
1070 |
|
1071 // Create TDelimitedPathSegmentParser object and do parsing |
|
1072 CDelimitedPathSegment16* data16Bit = CDelimitedPathSegment16::NewL(aData); // Also excersies NewLC() |
|
1073 CleanupStack::PushL(data16Bit); |
|
1074 |
|
1075 // Do initial parse and get to position |
|
1076 data16Bit->ParseReverse(); |
|
1077 TInt error = DoDelimitedDataParseToPosition(data16Bit, aStartPos); |
|
1078 if( error == KErrNone ) |
|
1079 { |
|
1080 error = DoDelimitedDataInsertAndEscapeL<HBufC16, TPtrC16>(data16Bit, aList1); |
|
1081 } |
|
1082 CleanupStack::PopAndDestroy(2, title16Bit); // title16Bit, data16Bit |
|
1083 aTestHarness->EndTest(error); |
|
1084 |
|
1085 // Make 8-bit copy |
|
1086 HBufC8* dataBuf = HBufC8::NewLC(aData.Length()); |
|
1087 TPtr8 initData8Bit = dataBuf->Des(); |
|
1088 initData8Bit.Copy(aData); |
|
1089 |
|
1090 // Create title |
|
1091 HBufC* title8Bit = HBufC::NewLC(aTestTitle.Length() + KTitle8Bit().Length()); |
|
1092 title8Bit->Des().Format(KTitle8Bit, &aTestTitle); |
|
1093 aTestHarness->StartTestL(*title8Bit); |
|
1094 |
|
1095 // Create TDelimitedPathSegmentParser object and do parsing |
|
1096 CDelimitedPathSegment8* data8Bit = CDelimitedPathSegment8::NewL(initData8Bit); // Also excersies NewLC() |
|
1097 CleanupStack::PushL(data8Bit); |
|
1098 |
|
1099 // Do initial parse and get to position |
|
1100 data8Bit->ParseReverse(); |
|
1101 error = DoDelimitedDataParseToPosition(data8Bit, aStartPos); |
|
1102 if( error == KErrNone ) |
|
1103 { |
|
1104 error = DoDelimitedDataInsertAndEscapeL<HBufC8, TPtrC8>(data8Bit, aList2); |
|
1105 } |
|
1106 aTestHarness->EndTest(error); |
|
1107 CleanupStack::PopAndDestroy(3, dataBuf); // dataBuf, title8Bit, data8Bit |
|
1108 } |
|
1109 |
|
1110 // |
|
1111 // |
|
1112 // Implementation of LOCAL functions - helper functions |
|
1113 // |
|
1114 // |
|
1115 |
|
1116 #include "TDelimitedDataCommon.cpp" |
|
1117 |