|
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 15 |
|
15 // |
|
16 // |
|
17 |
|
18 // EPOC includes |
|
19 #include <e32base.h> |
|
20 #include <in_sock.h> |
|
21 |
|
22 // Test system includes |
|
23 #include "EsockTestSection15.h" |
|
24 |
|
25 |
|
26 // Test step 15.1 |
|
27 const TDesC& CEsockTest15_1::GetTestName() |
|
28 { |
|
29 // store the name of this test case |
|
30 _LIT(ret,"Test15.1"); |
|
31 return ret; |
|
32 } |
|
33 |
|
34 CEsockTest15_1::~CEsockTest15_1() |
|
35 { |
|
36 appendixInArray.Close(); |
|
37 } |
|
38 |
|
39 enum TVerdict CEsockTest15_1::easyTestStepL() |
|
40 { |
|
41 TInetAddr addr; |
|
42 TBuf<39> buf; |
|
43 |
|
44 // input valid IP addresses |
|
45 |
|
46 // get valid IPv4 Addresses - appendixInArray |
|
47 if (!GetAppendixB1()) |
|
48 { |
|
49 return EFail; |
|
50 } |
|
51 |
|
52 // for each IP address |
|
53 for (TInt i = 0; i < appendixInArray.Count(); i++) |
|
54 { |
|
55 // convert to a string |
|
56 appendixInArray[i].OutputWithScope(buf); |
|
57 |
|
58 // check Input is successful |
|
59 TESTL(addr.Input(buf)==KErrNone); |
|
60 TESTL(appendixInArray[i].CmpAddr(addr) ); |
|
61 } |
|
62 |
|
63 appendixInArray.Reset(); |
|
64 return EPass; |
|
65 } |
|
66 |
|
67 |
|
68 // Test step 15.2 |
|
69 const TDesC& CEsockTest15_2::GetTestName() |
|
70 { |
|
71 // store the name of this test case |
|
72 _LIT(ret,"Test15.2"); |
|
73 return ret; |
|
74 } |
|
75 |
|
76 CEsockTest15_2::~CEsockTest15_2() |
|
77 { |
|
78 } |
|
79 |
|
80 enum TVerdict CEsockTest15_2::easyTestStepL() |
|
81 { |
|
82 TInetAddr addr; |
|
83 |
|
84 // input invalid IP addresses |
|
85 TESTL(addr.Input(_L("256.1.2.3"))!=KErrNone); |
|
86 TESTL(addr.Input(_L("56.1.999.3"))!=KErrNone); |
|
87 TESTL(addr.Input(_L("0x1000000000"))!=KErrNone); |
|
88 TESTL(addr.Input(_L("10.0x1000000"))!=KErrNone); |
|
89 TESTL(addr.Input(_L("10.0.0x10000"))!=KErrNone); |
|
90 TESTL(addr.Input(_L("10.0.0.0x100"))!=KErrNone); |
|
91 TESTL(addr.Input(_L("56.1.XYZ.3"))!=KErrNone); |
|
92 TESTL(addr.Input(_L("..1.2.3"))!=KErrNone); |
|
93 TESTL(addr.Input(_L("1.2.3.4."))!=KErrNone); |
|
94 TESTL(addr.Input(_L("www.symbian.com"))!=KErrNone); |
|
95 |
|
96 return EPass; |
|
97 } |
|
98 |
|
99 |
|
100 // Test step 15.3 |
|
101 const TDesC& CEsockTest15_3::GetTestName() |
|
102 { |
|
103 // store the name of this test case |
|
104 _LIT(ret,"Test15.3"); |
|
105 return ret; |
|
106 } |
|
107 |
|
108 CEsockTest15_3::~CEsockTest15_3() |
|
109 { |
|
110 appendixInArray.Close(); |
|
111 } |
|
112 |
|
113 enum TVerdict CEsockTest15_3::easyTestStepL() |
|
114 { |
|
115 TBuf<39> buf; |
|
116 TInetAddr addr; |
|
117 |
|
118 // Output |
|
119 |
|
120 // get valid IPv4 Addresses - appendixInArray |
|
121 if (!GetAppendixB1()) |
|
122 { |
|
123 return EFail; |
|
124 } |
|
125 |
|
126 // for each IP address |
|
127 for (TInt i = 0; i < appendixInArray.Count(); i++) |
|
128 { |
|
129 // call Output for each IP address |
|
130 appendixInArray[i].OutputWithScope(buf); |
|
131 |
|
132 // check buffer is populated |
|
133 TESTL( buf.Length()>0); |
|
134 |
|
135 addr.Input( buf ); |
|
136 TESTL( appendixInArray[i].CmpAddr(addr) ); |
|
137 } |
|
138 |
|
139 appendixInArray.Reset(); |
|
140 return EPass; |
|
141 } |
|
142 |