OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:io'; | 5 import 'dart:io'; |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 | 8 |
9 void testDefaultAddresses() { | 9 void testDefaultAddresses() { |
10 var loopback4 = InternetAddress.LOOPBACK_IP_V4; | 10 var loopback4 = InternetAddress.LOOPBACK_IP_V4; |
11 Expect.isNotNull(loopback4); | 11 Expect.isNotNull(loopback4); |
12 Expect.equals(InternetAddressType.IP_V4, loopback4.type); | 12 Expect.equals(InternetAddressType.IP_V4, loopback4.type); |
13 Expect.equals("localhost", loopback4.host); | 13 Expect.equals("127.0.0.1", loopback4.host); |
14 Expect.equals("127.0.0.1", loopback4.address); | 14 Expect.equals("127.0.0.1", loopback4.address); |
15 | 15 |
16 var loopback6 = InternetAddress.LOOPBACK_IP_V6; | 16 var loopback6 = InternetAddress.LOOPBACK_IP_V6; |
17 Expect.isNotNull(loopback6); | 17 Expect.isNotNull(loopback6); |
18 Expect.equals(InternetAddressType.IP_V6, loopback6.type); | 18 Expect.equals(InternetAddressType.IP_V6, loopback6.type); |
19 Expect.equals("ip6-localhost", loopback6.host); | 19 Expect.equals("::1", loopback6.host); |
20 Expect.equals("::1", loopback6.address); | 20 Expect.equals("::1", loopback6.address); |
21 | 21 |
22 var any4 = InternetAddress.ANY_IP_V4; | 22 var any4 = InternetAddress.ANY_IP_V4; |
23 Expect.isNotNull(any4); | 23 Expect.isNotNull(any4); |
24 Expect.equals(InternetAddressType.IP_V4, any4.type); | 24 Expect.equals(InternetAddressType.IP_V4, any4.type); |
25 Expect.equals("0.0.0.0", any4.host); | 25 Expect.equals("0.0.0.0", any4.host); |
26 Expect.equals("0.0.0.0", any4.address); | 26 Expect.equals("0.0.0.0", any4.address); |
27 | 27 |
28 var any6 = InternetAddress.ANY_IP_V6; | 28 var any6 = InternetAddress.ANY_IP_V6; |
29 Expect.isNotNull(any6); | 29 Expect.isNotNull(any6); |
(...skipping 28 matching lines...) Expand all Loading... |
58 Expect.notEquals('127.0.0.1', addr.host); | 58 Expect.notEquals('127.0.0.1', addr.host); |
59 }); | 59 }); |
60 }); | 60 }); |
61 } | 61 } |
62 | 62 |
63 void main() { | 63 void main() { |
64 testDefaultAddresses(); | 64 testDefaultAddresses(); |
65 testLookup(); | 65 testLookup(); |
66 testReverseLookup(); | 66 testReverseLookup(); |
67 } | 67 } |
OLD | NEW |