|
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 13 |
|
15 // |
|
16 // |
|
17 |
|
18 // EPOC includes |
|
19 #include <e32base.h> |
|
20 #include <in_sock.h> |
|
21 |
|
22 // Test system includes |
|
23 #include "EsockTestSection13.h" |
|
24 |
|
25 |
|
26 // Test step 13.1 |
|
27 const TDesC& CEsockTest13_1::GetTestName() |
|
28 { |
|
29 // store the name of this test case |
|
30 _LIT(ret,"Test13.1"); |
|
31 return ret; |
|
32 } |
|
33 |
|
34 CEsockTest13_1::~CEsockTest13_1() |
|
35 { |
|
36 } |
|
37 |
|
38 enum TVerdict CEsockTest13_1::easyTestStepL() |
|
39 { |
|
40 TInetAddr addr, addr1, addr2; |
|
41 |
|
42 // setting the IP address |
|
43 |
|
44 // get IP addresses from script |
|
45 TESTL(GetIpAddressFromConfig(_L("Test_13.1"), _L("ipAddress1"), addr1)); |
|
46 TESTL(GetIpAddressFromConfig(_L("Test_13.1"), _L("ipAddress2"), addr2)); |
|
47 |
|
48 // convert IP address to TUint32 |
|
49 TUint32 longAddr=addr1.Address(); |
|
50 |
|
51 // set the IP address |
|
52 addr.SetAddress(longAddr); |
|
53 |
|
54 // check port number is 0 |
|
55 TESTL(addr.Port() == 0); |
|
56 |
|
57 // check IP address has been assigned correctly |
|
58 TESTL(addr.Match(addr1)); |
|
59 |
|
60 // change the IP address and repeat tests |
|
61 longAddr=addr2.Address(); |
|
62 addr.SetAddress(longAddr); |
|
63 TESTL(addr.Port() == 0); |
|
64 TESTL(addr.Match(addr2)); |
|
65 |
|
66 return EPass; |
|
67 } |
|
68 |
|
69 |
|
70 // Test step 13.2 |
|
71 const TDesC& CEsockTest13_2::GetTestName() |
|
72 { |
|
73 // store the name of this test case |
|
74 _LIT(ret,"Test13.2"); |
|
75 return ret; |
|
76 } |
|
77 |
|
78 CEsockTest13_2::~CEsockTest13_2() |
|
79 { |
|
80 } |
|
81 |
|
82 enum TVerdict CEsockTest13_2::easyTestStepL() |
|
83 { |
|
84 TInetAddr addr1, addr2; |
|
85 TInetAddr addr; |
|
86 |
|
87 // getting the IP address |
|
88 |
|
89 // get IP addresses from script |
|
90 TESTL(GetIpAddressFromConfig(_L("Test_13.2"), _L("ipAddress1"), addr1)); |
|
91 TESTL(GetIpAddressFromConfig(_L("Test_13.2"), _L("ipAddress2"), addr2)); |
|
92 |
|
93 // convert IP address to TUint32 |
|
94 TUint32 longAddr=addr1.Address(); |
|
95 |
|
96 // set the IP address |
|
97 addr.SetAddress(longAddr); |
|
98 |
|
99 // get the IP address and check against the input |
|
100 TUint32 tmpAddr=addr.Address(); |
|
101 TESTL(longAddr==tmpAddr); |
|
102 |
|
103 // change the IP address and repeat tests |
|
104 longAddr=addr2.Address(); |
|
105 addr.SetAddress(longAddr); |
|
106 tmpAddr=addr.Address(); |
|
107 TESTL(longAddr==tmpAddr); |
|
108 |
|
109 return EPass; |
|
110 } |
|
111 |