|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32math.h> |
|
23 #include "FavouritesEngineTest.h" |
|
24 |
|
25 // EXTERNAL DATA STRUCTURES |
|
26 // None |
|
27 |
|
28 // EXTERNAL FUNCTION PROTOTYPES |
|
29 // None |
|
30 |
|
31 // CONSTANTS |
|
32 // None |
|
33 |
|
34 // MACROS |
|
35 // None |
|
36 |
|
37 // LOCAL CONSTANTS AND MACROS |
|
38 // None |
|
39 |
|
40 // MODULE DATA STRUCTURES |
|
41 // None |
|
42 |
|
43 // LOCAL FUNCTION PROTOTYPES |
|
44 // None |
|
45 |
|
46 // FORWARD DECLARATIONS |
|
47 // None |
|
48 |
|
49 // ==================== LOCAL FUNCTIONS ======================================= |
|
50 |
|
51 |
|
52 // ============================ MEMBER FUNCTIONS =============================== |
|
53 |
|
54 /* |
|
55 ------------------------------------------------------------------------------- |
|
56 |
|
57 Class: CFavouritesEngineTest |
|
58 |
|
59 Method: WapApConstructorTest |
|
60 |
|
61 Description: Test the WapAp constructor method. |
|
62 |
|
63 Parameters: TTestResult& aErrorDescription: out: |
|
64 Test result and on error case a short description of error |
|
65 |
|
66 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
67 |
|
68 Errors/Exceptions: None |
|
69 |
|
70 Status: Approved |
|
71 |
|
72 ------------------------------------------------------------------------------- |
|
73 */ |
|
74 TInt CFavouritesEngineTest::WapApConstructorTest( TTestResult& aResult ) |
|
75 { |
|
76 /* Simple server connect */ |
|
77 _LIT( KDefinition ,"State"); |
|
78 _LIT( KData ,"Test the WapAp constructor method"); |
|
79 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
80 |
|
81 TFavouritesWapAp accessPoint; |
|
82 |
|
83 accessPoint = 222; |
|
84 |
|
85 _LIT( KData2 ,"Finished" ); |
|
86 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
87 |
|
88 if(accessPoint.ApId() == 222) |
|
89 { |
|
90 _LIT( KDescription , "Test case passed"); |
|
91 aResult.SetResult( KErrNone, KDescription ); |
|
92 } |
|
93 else |
|
94 { |
|
95 _LIT( KDescription , "Test case failed"); |
|
96 aResult.SetResult( KErrGeneral, KDescription ); |
|
97 } |
|
98 |
|
99 // Case was executed |
|
100 return KErrNone; |
|
101 } |
|
102 |
|
103 /* |
|
104 ------------------------------------------------------------------------------- |
|
105 |
|
106 Class: CFavouritesEngineTest |
|
107 |
|
108 Method: WapApAssignWithApTest |
|
109 |
|
110 Description: Test the WapAp assign(=) operater using a WapAp as the argument. |
|
111 |
|
112 Parameters: TTestResult& aErrorDescription: out: |
|
113 Test result and on error case a short description of error |
|
114 |
|
115 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
116 |
|
117 Errors/Exceptions: None |
|
118 |
|
119 Status: Approved |
|
120 |
|
121 ------------------------------------------------------------------------------- |
|
122 */ |
|
123 TInt CFavouritesEngineTest::WapApAssignWithApTest( TTestResult& aResult ) |
|
124 { |
|
125 /* Simple server connect */ |
|
126 _LIT( KDefinition ,"State"); |
|
127 _LIT( KData ,"Test the WapAp assign(=) operater using a WapAp as the argument"); |
|
128 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
129 |
|
130 TFavouritesWapAp accessPoint1, accessPoint2; |
|
131 |
|
132 accessPoint1 = 222; |
|
133 |
|
134 accessPoint2 = accessPoint1; |
|
135 |
|
136 _LIT( KData2 ,"Finished" ); |
|
137 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
138 |
|
139 if(accessPoint2.ApId() == 222) |
|
140 { |
|
141 _LIT( KDescription , "Test case passed"); |
|
142 aResult.SetResult( KErrNone, KDescription ); |
|
143 } |
|
144 else |
|
145 { |
|
146 _LIT( KDescription , "Test case failed"); |
|
147 aResult.SetResult( KErrGeneral, KDescription ); |
|
148 } |
|
149 |
|
150 // Case was executed |
|
151 return KErrNone; |
|
152 } |
|
153 |
|
154 /* |
|
155 ------------------------------------------------------------------------------- |
|
156 |
|
157 Class: CFavouritesEngineTest |
|
158 |
|
159 Method: WapApAssignWithApIdTest |
|
160 |
|
161 Description: Test the WapAp assign(=) operater using an ApId as the argument. |
|
162 |
|
163 Parameters: TTestResult& aErrorDescription: out: |
|
164 Test result and on error case a short description of error |
|
165 |
|
166 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
167 |
|
168 Errors/Exceptions: None |
|
169 |
|
170 Status: Approved |
|
171 |
|
172 ------------------------------------------------------------------------------- |
|
173 */ |
|
174 TInt CFavouritesEngineTest::WapApAssignWithApIdTest( TTestResult& aResult ) |
|
175 { |
|
176 /* Simple server connect */ |
|
177 _LIT( KDefinition ,"State"); |
|
178 _LIT( KData ,"Test the WapAp assign(=) operater using an ApId as the argument"); |
|
179 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
180 |
|
181 TFavouritesWapAp accessPoint; |
|
182 |
|
183 accessPoint = 222; |
|
184 |
|
185 _LIT( KData2 ,"Finished" ); |
|
186 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
187 |
|
188 if(accessPoint.ApId() == 222) |
|
189 { |
|
190 _LIT( KDescription , "Test case passed"); |
|
191 aResult.SetResult( KErrNone, KDescription ); |
|
192 } |
|
193 else |
|
194 { |
|
195 _LIT( KDescription , "Test case failed"); |
|
196 aResult.SetResult( KErrGeneral, KDescription ); |
|
197 } |
|
198 |
|
199 // Case was executed |
|
200 return KErrNone; |
|
201 } |
|
202 |
|
203 /* |
|
204 ------------------------------------------------------------------------------- |
|
205 |
|
206 Class: CFavouritesEngineTest |
|
207 |
|
208 Method: WapApSetNullTest |
|
209 |
|
210 Description: Test the WapAp SetNull method. |
|
211 |
|
212 Parameters: TTestResult& aErrorDescription: out: |
|
213 Test result and on error case a short description of error |
|
214 |
|
215 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
216 |
|
217 Errors/Exceptions: None |
|
218 |
|
219 Status: Approved |
|
220 |
|
221 ------------------------------------------------------------------------------- |
|
222 */ |
|
223 TInt CFavouritesEngineTest::WapApSetNullTest( TTestResult& aResult ) |
|
224 { |
|
225 /* Simple server connect */ |
|
226 _LIT( KDefinition ,"State"); |
|
227 _LIT( KData ,"Test the WapAp SetNull method"); |
|
228 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
229 |
|
230 TFavouritesWapAp accessPoint; |
|
231 |
|
232 accessPoint.SetNull(); |
|
233 |
|
234 _LIT( KData2 ,"Finished" ); |
|
235 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
236 |
|
237 if(accessPoint.IsNull()) |
|
238 { |
|
239 _LIT( KDescription , "Test case passed"); |
|
240 aResult.SetResult( KErrNone, KDescription ); |
|
241 } |
|
242 else |
|
243 { |
|
244 _LIT( KDescription , "Test case failed"); |
|
245 aResult.SetResult( KErrGeneral, KDescription ); |
|
246 } |
|
247 |
|
248 // Case was executed |
|
249 return KErrNone; |
|
250 } |
|
251 |
|
252 /* |
|
253 ------------------------------------------------------------------------------- |
|
254 |
|
255 Class: CFavouritesEngineTest |
|
256 |
|
257 Method: WapApSetDefaultTest |
|
258 |
|
259 Description: Test the WapAp SetDefault method. |
|
260 |
|
261 Parameters: TTestResult& aErrorDescription: out: |
|
262 Test result and on error case a short description of error |
|
263 |
|
264 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
265 |
|
266 Errors/Exceptions: None |
|
267 |
|
268 Status: Approved |
|
269 |
|
270 ------------------------------------------------------------------------------- |
|
271 */ |
|
272 TInt CFavouritesEngineTest::WapApSetDefaultTest( TTestResult& aResult ) |
|
273 { |
|
274 /* Simple server connect */ |
|
275 _LIT( KDefinition ,"State"); |
|
276 _LIT( KData ,"Test the WapAp SetDefault method"); |
|
277 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
278 |
|
279 TFavouritesWapAp accessPoint; |
|
280 |
|
281 accessPoint.SetDefault(); |
|
282 |
|
283 _LIT( KData2 ,"Finished" ); |
|
284 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
285 |
|
286 if(accessPoint.IsDefault()) |
|
287 { |
|
288 _LIT( KDescription , "Test case passed"); |
|
289 aResult.SetResult( KErrNone, KDescription ); |
|
290 } |
|
291 else |
|
292 { |
|
293 _LIT( KDescription , "Test case failed"); |
|
294 aResult.SetResult( KErrGeneral, KDescription ); |
|
295 } |
|
296 |
|
297 // Case was executed |
|
298 return KErrNone; |
|
299 } |
|
300 |
|
301 /* |
|
302 ------------------------------------------------------------------------------- |
|
303 |
|
304 Class: CFavouritesEngineTest |
|
305 |
|
306 Method: WapApSetApIdTest |
|
307 |
|
308 Description: Test the WapAp SetApId method. |
|
309 |
|
310 Parameters: TTestResult& aErrorDescription: out: |
|
311 Test result and on error case a short description of error |
|
312 |
|
313 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
314 |
|
315 Errors/Exceptions: None |
|
316 |
|
317 Status: Approved |
|
318 |
|
319 ------------------------------------------------------------------------------- |
|
320 */ |
|
321 TInt CFavouritesEngineTest::WapApSetApIdTest( TTestResult& aResult ) |
|
322 { |
|
323 /* Simple server connect */ |
|
324 _LIT( KDefinition ,"State"); |
|
325 _LIT( KData ,"Test the WapAp SetApId method"); |
|
326 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
327 |
|
328 TFavouritesWapAp accessPoint; |
|
329 |
|
330 accessPoint.SetApId(222); |
|
331 |
|
332 _LIT( KData2 ,"Finished" ); |
|
333 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
334 |
|
335 if(accessPoint.ApId() == 222) |
|
336 { |
|
337 _LIT( KDescription , "Test case passed"); |
|
338 aResult.SetResult( KErrNone, KDescription ); |
|
339 } |
|
340 else |
|
341 { |
|
342 _LIT( KDescription , "Test case failed"); |
|
343 aResult.SetResult( KErrGeneral, KDescription ); |
|
344 } |
|
345 |
|
346 // Case was executed |
|
347 return KErrNone; |
|
348 } |
|
349 |
|
350 /* |
|
351 ------------------------------------------------------------------------------- |
|
352 |
|
353 Class: CFavouritesEngineTest |
|
354 |
|
355 Method: WapApIsNullTest |
|
356 |
|
357 Description: Test the WapAp IsNull method. |
|
358 |
|
359 Parameters: TTestResult& aErrorDescription: out: |
|
360 Test result and on error case a short description of error |
|
361 |
|
362 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
363 |
|
364 Errors/Exceptions: None |
|
365 |
|
366 Status: Approved |
|
367 |
|
368 ------------------------------------------------------------------------------- |
|
369 */ |
|
370 TInt CFavouritesEngineTest::WapApIsNullTest( TTestResult& aResult ) |
|
371 { |
|
372 /* Simple server connect */ |
|
373 _LIT( KDefinition ,"State"); |
|
374 _LIT( KData ,"Test the WapAp IsNull method"); |
|
375 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
376 |
|
377 TFavouritesWapAp accessPoint; |
|
378 |
|
379 accessPoint.SetNull(); |
|
380 |
|
381 TBool isNull = accessPoint.IsNull(); |
|
382 |
|
383 _LIT( KData2 ,"Finished" ); |
|
384 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
385 |
|
386 if(isNull) |
|
387 { |
|
388 _LIT( KDescription , "Test case passed"); |
|
389 aResult.SetResult( KErrNone, KDescription ); |
|
390 } |
|
391 else |
|
392 { |
|
393 _LIT( KDescription , "Test case failed"); |
|
394 aResult.SetResult( KErrGeneral, KDescription ); |
|
395 } |
|
396 |
|
397 // Case was executed |
|
398 return KErrNone; |
|
399 } |
|
400 |
|
401 /* |
|
402 ------------------------------------------------------------------------------- |
|
403 |
|
404 Class: CFavouritesEngineTest |
|
405 |
|
406 Method: WapApIsDefaultTest |
|
407 |
|
408 Description: Test the WapAp IsDefault method. |
|
409 |
|
410 Parameters: TTestResult& aErrorDescription: out: |
|
411 Test result and on error case a short description of error |
|
412 |
|
413 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
414 |
|
415 Errors/Exceptions: None |
|
416 |
|
417 Status: Approved |
|
418 |
|
419 ------------------------------------------------------------------------------- |
|
420 */ |
|
421 TInt CFavouritesEngineTest::WapApIsDefaultTest( TTestResult& aResult ) |
|
422 { |
|
423 /* Simple server connect */ |
|
424 _LIT( KDefinition ,"State" ); |
|
425 _LIT( KData ,"Test the WapAp IsDefault method" ); |
|
426 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
427 |
|
428 TFavouritesWapAp accessPoint; |
|
429 |
|
430 accessPoint.SetDefault(); |
|
431 |
|
432 TBool isDefault = accessPoint.IsDefault(); |
|
433 |
|
434 _LIT( KData2 ,"Finished" ); |
|
435 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
436 |
|
437 if( isDefault ) |
|
438 { |
|
439 _LIT( KDescription , "Test case passed"); |
|
440 aResult.SetResult( KErrNone, KDescription ); |
|
441 } |
|
442 else |
|
443 { |
|
444 _LIT( KDescription , "Test case failed"); |
|
445 aResult.SetResult( KErrGeneral, KDescription ); |
|
446 } |
|
447 |
|
448 // Case was executed |
|
449 return KErrNone; |
|
450 } |
|
451 |
|
452 /* |
|
453 ------------------------------------------------------------------------------- |
|
454 |
|
455 Class: CFavouritesEngineTest |
|
456 |
|
457 Method: WapApApIdTest |
|
458 |
|
459 Description: Test the WapAp ApId method. |
|
460 |
|
461 Parameters: TTestResult& aErrorDescription: out: |
|
462 Test result and on error case a short description of error |
|
463 |
|
464 Return Values: TInt: Always KErrNone to indicate that test was valid |
|
465 |
|
466 Errors/Exceptions: None |
|
467 |
|
468 Status: Approved |
|
469 |
|
470 ------------------------------------------------------------------------------- |
|
471 */ |
|
472 TInt CFavouritesEngineTest::WapApApIdTest( TTestResult& aResult ) |
|
473 { |
|
474 /* Simple server connect */ |
|
475 _LIT( KDefinition ,"State" ); |
|
476 _LIT( KData ,"Test the WapAp ApId method" ); |
|
477 TestModuleIf().Printf( 0, KDefinition, KData ); |
|
478 |
|
479 TFavouritesWapAp accessPoint; |
|
480 |
|
481 accessPoint.SetApId( 222 ); |
|
482 |
|
483 TUint32 apId = accessPoint.ApId(); |
|
484 |
|
485 TBool isDefault = accessPoint.IsDefault(); |
|
486 |
|
487 _LIT( KData2 ,"Finished" ); |
|
488 TestModuleIf().Printf( 0, KDefinition, KData2 ); |
|
489 |
|
490 if( apId == 222 ) |
|
491 { |
|
492 _LIT( KDescription , "Test case passed" ); |
|
493 aResult.SetResult( KErrNone, KDescription ); |
|
494 } |
|
495 else |
|
496 { |
|
497 _LIT( KDescription , "Test case failed" ); |
|
498 aResult.SetResult( KErrGeneral, KDescription ); |
|
499 } |
|
500 |
|
501 // Case was executed |
|
502 return KErrNone; |
|
503 } |
|
504 |
|
505 // ================= OTHER EXPORTED FUNCTIONS ================================= |
|
506 |
|
507 // End of File |