|
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 // This contains ESock Test cases from section 23 |
|
15 // |
|
16 // |
|
17 |
|
18 // EPOC includes |
|
19 #include <e32base.h> |
|
20 #include <in_sock.h> |
|
21 |
|
22 // Test system includes |
|
23 #include "EsockTestSection23.h" |
|
24 |
|
25 |
|
26 |
|
27 // Test step 23.1 |
|
28 const TDesC& CEsockTest23_1::GetTestName() |
|
29 { |
|
30 // store the name of this test case |
|
31 _LIT(ret,"Test23.1"); |
|
32 return ret; |
|
33 } |
|
34 |
|
35 CEsockTest23_1::~CEsockTest23_1() |
|
36 { |
|
37 appendixInArray.Close(); |
|
38 } |
|
39 |
|
40 enum TVerdict CEsockTest23_1::easyTestStepL() |
|
41 { |
|
42 |
|
43 // IsClassA |
|
44 |
|
45 // get list of IP addresses |
|
46 if (!GetAppendixC1()) |
|
47 { |
|
48 return EFail; |
|
49 } |
|
50 |
|
51 // for each IP address |
|
52 for (TInt i=0; i < appendixInArray.Count(); i++) |
|
53 { |
|
54 // check if the address is type class A. They all should fail as they make no sense for ip6. |
|
55 TESTL(appendixInArray[i].IsClassA()==EFalse); |
|
56 } |
|
57 |
|
58 appendixInArray.Reset(); |
|
59 return EPass; |
|
60 } |
|
61 |
|
62 |
|
63 |
|
64 // Test step 23.2 |
|
65 const TDesC& CEsockTest23_2::GetTestName() |
|
66 { |
|
67 // store the name of this test case |
|
68 _LIT(ret,"Test23.2"); |
|
69 return ret; |
|
70 } |
|
71 |
|
72 CEsockTest23_2::~CEsockTest23_2() |
|
73 { |
|
74 appendixInArray.Close(); |
|
75 } |
|
76 |
|
77 enum TVerdict CEsockTest23_2::easyTestStepL() |
|
78 { |
|
79 |
|
80 // IsClassB |
|
81 |
|
82 // get list of IP addresses |
|
83 if (!GetAppendixC1()) |
|
84 { |
|
85 return EFail; |
|
86 } |
|
87 |
|
88 // for each IP address |
|
89 for (TInt i=0; i < appendixInArray.Count(); i++) |
|
90 { |
|
91 // check if the address is type class B |
|
92 TESTL(appendixInArray[i].IsClassB()==EFalse); |
|
93 } |
|
94 |
|
95 appendixInArray.Reset(); |
|
96 return EPass; |
|
97 } |
|
98 |
|
99 |
|
100 // Test step 23.3 |
|
101 const TDesC& CEsockTest23_3::GetTestName() |
|
102 { |
|
103 // store the name of this test case |
|
104 _LIT(ret,"Test23.3"); |
|
105 return ret; |
|
106 } |
|
107 |
|
108 CEsockTest23_3::~CEsockTest23_3() |
|
109 { |
|
110 appendixInArray.Close(); |
|
111 } |
|
112 |
|
113 enum TVerdict CEsockTest23_3::easyTestStepL() |
|
114 { |
|
115 |
|
116 // IsClassC |
|
117 |
|
118 // get list of IP addresses |
|
119 if (!GetAppendixC1()) |
|
120 { |
|
121 return EFail; |
|
122 } |
|
123 |
|
124 // for each IP address |
|
125 for (TInt i=0; i < appendixInArray.Count(); i++) |
|
126 { |
|
127 // check if the address is type class C |
|
128 TESTL(appendixInArray[i].IsClassC()==EFalse); |
|
129 } |
|
130 |
|
131 appendixInArray.Reset(); |
|
132 return EPass; |
|
133 } |
|
134 |
|
135 |
|
136 // Test step 23.4 |
|
137 const TDesC& CEsockTest23_4::GetTestName() |
|
138 { |
|
139 // store the name of this test case |
|
140 _LIT(ret,"Test23.4"); |
|
141 return ret; |
|
142 } |
|
143 |
|
144 CEsockTest23_4::~CEsockTest23_4() |
|
145 { |
|
146 appendixInArray.Close(); |
|
147 } |
|
148 |
|
149 enum TVerdict CEsockTest23_4::easyTestStepL() |
|
150 { |
|
151 |
|
152 // IsMulticast |
|
153 |
|
154 // get list of IP addresses |
|
155 if (!GetAppendixC1()) |
|
156 { |
|
157 return EFail; |
|
158 } |
|
159 |
|
160 // for each IP address |
|
161 for (TInt i=0; i < appendixInArray.Count(); i++) |
|
162 { |
|
163 if (i == ipAddress4 || i == ipAddress5 ) |
|
164 { |
|
165 // check if the address is type multicast |
|
166 TESTL(appendixInArray[i].IsMulticast()!=EFalse); |
|
167 } |
|
168 else //address is not multicast |
|
169 { |
|
170 TESTL(appendixInArray[i].IsMulticast()==EFalse); |
|
171 } |
|
172 } |
|
173 |
|
174 appendixInArray.Reset(); |
|
175 return EPass; |
|
176 } |
|
177 |
|
178 |
|
179 // Test step 23.5 |
|
180 const TDesC& CEsockTest23_5::GetTestName() |
|
181 { |
|
182 // store the name of this test case |
|
183 _LIT(ret,"Test23.5"); |
|
184 return ret; |
|
185 } |
|
186 |
|
187 CEsockTest23_5::~CEsockTest23_5() |
|
188 { |
|
189 appendixInArray.Close(); |
|
190 } |
|
191 |
|
192 enum TVerdict CEsockTest23_5::easyTestStepL() |
|
193 { |
|
194 // TBool bRet; |
|
195 |
|
196 // IsWildAddr |
|
197 |
|
198 // get list of IP addresses |
|
199 if (!GetAppendixC1()) |
|
200 { |
|
201 return EFail; |
|
202 } |
|
203 |
|
204 // for each IP address |
|
205 for (TInt i=0; i < appendixInArray.Count(); i++) |
|
206 { |
|
207 // check if the address is the wild address |
|
208 |
|
209 // only first address is the wild address |
|
210 if (i == ipAddress1) |
|
211 { |
|
212 TESTL(appendixInArray[i].IsWildAddr()!=EFalse); |
|
213 } |
|
214 else |
|
215 { |
|
216 TESTL(appendixInArray[i].IsWildAddr()==EFalse); |
|
217 } |
|
218 } |
|
219 |
|
220 appendixInArray.Reset(); |
|
221 return EPass; |
|
222 } |
|
223 |
|
224 |
|
225 // Test step 23.6 |
|
226 const TDesC& CEsockTest23_6::GetTestName() |
|
227 { |
|
228 // store the name of this test case |
|
229 _LIT(ret,"Test23.6"); |
|
230 return ret; |
|
231 } |
|
232 |
|
233 CEsockTest23_6::~CEsockTest23_6() |
|
234 { |
|
235 appendixInArray.Close(); |
|
236 } |
|
237 |
|
238 enum TVerdict CEsockTest23_6::easyTestStepL() |
|
239 { |
|
240 |
|
241 // IsBroadcast |
|
242 |
|
243 // get list of IP addresses |
|
244 if (!GetAppendixC1()) |
|
245 { |
|
246 return EFail; |
|
247 } |
|
248 |
|
249 // for each IP address |
|
250 for (TInt i=0; i < appendixInArray.Count(); i++) |
|
251 { |
|
252 // check if the address is of type broadcast |
|
253 TESTL(appendixInArray[i].IsBroadcast()==EFalse); |
|
254 } |
|
255 |
|
256 appendixInArray.Reset(); |
|
257 return EPass; |
|
258 } |
|
259 |
|
260 |
|
261 // Test step 23.7 |
|
262 const TDesC& CEsockTest23_7::GetTestName() |
|
263 { |
|
264 // store the name of this test case |
|
265 _LIT(ret,"Test23.7"); |
|
266 return ret; |
|
267 } |
|
268 |
|
269 CEsockTest23_7::~CEsockTest23_7() |
|
270 { |
|
271 } |
|
272 |
|
273 enum TVerdict CEsockTest23_7::easyTestStepL() |
|
274 { |
|
275 TInetAddr addr; |
|
276 |
|
277 // IsWildPort |
|
278 |
|
279 // set the IP address |
|
280 const TIp6Addr KInet6addr = {{{ 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10 }}}; |
|
281 addr.SetAddress(KInet6addr); |
|
282 |
|
283 // set the port number |
|
284 addr.SetPort(0); |
|
285 |
|
286 // check if the port is the wild port |
|
287 TESTL(addr.IsWildPort()!=EFalse); |
|
288 |
|
289 // change the port number |
|
290 addr.SetPort(21); |
|
291 |
|
292 // check if the port is the wild port |
|
293 TESTL(addr.IsWildPort()==EFalse); |
|
294 |
|
295 appendixInArray.Reset(); |
|
296 return EPass; |
|
297 } |
|
298 |
|
299 |
|
300 // Test step 23.8 |
|
301 const TDesC& CEsockTest23_8::GetTestName() |
|
302 { |
|
303 // store the name of this test case |
|
304 _LIT(ret,"Test23.8"); |
|
305 return ret; |
|
306 } |
|
307 |
|
308 CEsockTest23_8::~CEsockTest23_8() |
|
309 { |
|
310 appendixInArray.Close(); |
|
311 } |
|
312 |
|
313 enum TVerdict CEsockTest23_8::easyTestStepL() |
|
314 { |
|
315 |
|
316 // IsLoopback |
|
317 |
|
318 // get list of IP addresses |
|
319 if (!GetAppendixC1()) |
|
320 { |
|
321 return EFail; |
|
322 } |
|
323 |
|
324 // for each IP address |
|
325 for (TInt i=0; i < appendixInArray.Count(); i++) |
|
326 { |
|
327 // check if the address is of type loopback |
|
328 if ((i == ipAddress2 )) |
|
329 { |
|
330 TESTL(appendixInArray[i].IsLoopback()!=EFalse); |
|
331 } |
|
332 else |
|
333 { |
|
334 TESTL(appendixInArray[i].IsLoopback()==EFalse); |
|
335 } |
|
336 } |
|
337 |
|
338 appendixInArray.Reset(); |
|
339 return EPass; |
|
340 } |
|
341 |
|
342 |
|
343 // Test step 23.9 |
|
344 const TDesC& CEsockTest23_9::GetTestName() |
|
345 { |
|
346 // store the name of this test case |
|
347 _LIT(ret,"Test23.9"); |
|
348 return ret; |
|
349 } |
|
350 |
|
351 CEsockTest23_9::~CEsockTest23_9() |
|
352 { |
|
353 appendixInArray.Close(); |
|
354 } |
|
355 |
|
356 enum TVerdict CEsockTest23_9::easyTestStepL() |
|
357 { |
|
358 |
|
359 // IsUnspecified |
|
360 |
|
361 // get list of IP addresses |
|
362 if (!GetAppendixC1()) |
|
363 { |
|
364 return EFail; |
|
365 } |
|
366 |
|
367 // for each IP address |
|
368 for (TInt i=0; i < appendixInArray.Count(); i++) |
|
369 { |
|
370 if (i == ipAddress1 ) |
|
371 { |
|
372 // check if the address is of type inspecified |
|
373 TESTL(appendixInArray[i].IsUnspecified()!=EFalse); |
|
374 } |
|
375 else |
|
376 { |
|
377 TESTL(appendixInArray[i].IsUnspecified()==EFalse); |
|
378 } |
|
379 } |
|
380 |
|
381 appendixInArray.Reset(); |
|
382 return EPass; |
|
383 } |
|
384 |
|
385 |
|
386 // Test step 23.10 |
|
387 const TDesC& CEsockTest23_10::GetTestName() |
|
388 { |
|
389 // store the name of this test case |
|
390 _LIT(ret,"Test23.10"); |
|
391 return ret; |
|
392 } |
|
393 |
|
394 CEsockTest23_10::~CEsockTest23_10() |
|
395 { |
|
396 appendixInArray.Close(); |
|
397 } |
|
398 |
|
399 enum TVerdict CEsockTest23_10::easyTestStepL() |
|
400 { |
|
401 |
|
402 // IsUnicast |
|
403 |
|
404 // get list of IP addresses |
|
405 if (!GetAppendixC1()) |
|
406 { |
|
407 return EFail; |
|
408 } |
|
409 |
|
410 // for each IP address |
|
411 for (TInt i=0; i < appendixInArray.Count(); i++) |
|
412 { |
|
413 // check if the address is of type unicast |
|
414 if (i == ipAddress2 || i== ipAddress3 || i >= ipAddress7 && i <= ipAddress9 ) |
|
415 { |
|
416 TESTL(appendixInArray[i].IsUnicast()!=EFalse); |
|
417 } |
|
418 else |
|
419 { |
|
420 TESTL(appendixInArray[i].IsUnicast()==EFalse); |
|
421 } |
|
422 } |
|
423 |
|
424 appendixInArray.Reset(); |
|
425 return EPass; |
|
426 } |
|
427 |