Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: tests/standalone/io/internet_address_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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("127.0.0.1", 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 Expect.listEquals([127, 0, 0, 1], loopback4.rawAddress); 15 Expect.listEquals([127, 0, 0, 1], loopback4.rawAddress);
16 16
17 var loopback6 = InternetAddress.LOOPBACK_IP_V6; 17 var loopback6 = InternetAddress.LOOPBACK_IP_V6;
18 Expect.isNotNull(loopback6); 18 Expect.isNotNull(loopback6);
19 Expect.equals(InternetAddressType.IP_V6, loopback6.type); 19 Expect.equals(InternetAddressType.IP_V6, loopback6.type);
20 Expect.equals("::1", loopback6.host); 20 Expect.equals("::1", loopback6.host);
21 Expect.equals("::1", loopback6.address); 21 Expect.equals("::1", loopback6.address);
22 Expect.listEquals([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], 22 Expect.listEquals(
23 loopback6.rawAddress); 23 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], loopback6.rawAddress);
24 24
25 var any4 = InternetAddress.ANY_IP_V4; 25 var any4 = InternetAddress.ANY_IP_V4;
26 Expect.isNotNull(any4); 26 Expect.isNotNull(any4);
27 Expect.equals(InternetAddressType.IP_V4, any4.type); 27 Expect.equals(InternetAddressType.IP_V4, any4.type);
28 Expect.equals("0.0.0.0", any4.host); 28 Expect.equals("0.0.0.0", any4.host);
29 Expect.equals("0.0.0.0", any4.address); 29 Expect.equals("0.0.0.0", any4.address);
30 30
31 var any6 = InternetAddress.ANY_IP_V6; 31 var any6 = InternetAddress.ANY_IP_V6;
32 Expect.isNotNull(any6); 32 Expect.isNotNull(any6);
33 Expect.equals(InternetAddressType.IP_V6, any6.type); 33 Expect.equals(InternetAddressType.IP_V6, any6.type);
(...skipping 27 matching lines...) Expand all
61 Expect.isFalse(ip6.isMulticast); 61 Expect.isFalse(ip6.isMulticast);
62 62
63 var multicast4 = new InternetAddress("224.1.2.3"); 63 var multicast4 = new InternetAddress("224.1.2.3");
64 Expect.equals(InternetAddressType.IP_V4, multicast4.type); 64 Expect.equals(InternetAddressType.IP_V4, multicast4.type);
65 Expect.isTrue(multicast4.isMulticast); 65 Expect.isTrue(multicast4.isMulticast);
66 66
67 var multicast6 = new InternetAddress("FF00::1:2:3"); 67 var multicast6 = new InternetAddress("FF00::1:2:3");
68 Expect.equals(InternetAddressType.IP_V6, multicast6.type); 68 Expect.equals(InternetAddressType.IP_V6, multicast6.type);
69 Expect.isTrue(multicast6.isMulticast); 69 Expect.isTrue(multicast6.isMulticast);
70 70
71 Expect.throws(() => new InternetAddress("1.2.3"), 71 Expect.throws(() => new InternetAddress("1.2.3"), (e) => e is ArgumentError);
72 (e) => e is ArgumentError); 72 Expect.throws(
73 Expect.throws(() => new InternetAddress("::FFFF::1"), 73 () => new InternetAddress("::FFFF::1"), (e) => e is ArgumentError);
74 (e) => e is ArgumentError);
75 } 74 }
76 75
77 void testEquality() { 76 void testEquality() {
78 Expect.equals(new InternetAddress("127.0.0.1"), 77 Expect.equals(
79 new InternetAddress("127.0.0.1")); 78 new InternetAddress("127.0.0.1"), new InternetAddress("127.0.0.1"));
80 Expect.equals(new InternetAddress("127.0.0.1"), 79 Expect.equals(
81 InternetAddress.LOOPBACK_IP_V4); 80 new InternetAddress("127.0.0.1"), InternetAddress.LOOPBACK_IP_V4);
82 Expect.equals(new InternetAddress("::1"), 81 Expect.equals(new InternetAddress("::1"), new InternetAddress("::1"));
83 new InternetAddress("::1")); 82 Expect.equals(new InternetAddress("::1"), InternetAddress.LOOPBACK_IP_V6);
84 Expect.equals(new InternetAddress("::1"),
85 InternetAddress.LOOPBACK_IP_V6);
86 Expect.equals(new InternetAddress("1:2:3:4:5:6:7:8"), 83 Expect.equals(new InternetAddress("1:2:3:4:5:6:7:8"),
87 new InternetAddress("1:2:3:4:5:6:7:8")); 84 new InternetAddress("1:2:3:4:5:6:7:8"));
88 Expect.equals(new InternetAddress("1::2"), 85 Expect.equals(
89 new InternetAddress("1:0:0:0:0:0:0:2")); 86 new InternetAddress("1::2"), new InternetAddress("1:0:0:0:0:0:0:2"));
90 Expect.equals(new InternetAddress("::FFFF:0:0:16.32.48.64"), 87 Expect.equals(new InternetAddress("::FFFF:0:0:16.32.48.64"),
91 new InternetAddress("::FFFF:0:0:1020:3040")); 88 new InternetAddress("::FFFF:0:0:1020:3040"));
92 89
93 var set = new Set(); 90 var set = new Set();
94 set.add(new InternetAddress("127.0.0.1")); 91 set.add(new InternetAddress("127.0.0.1"));
95 set.add(new InternetAddress("::1")); 92 set.add(new InternetAddress("::1"));
96 set.add(new InternetAddress("1:2:3:4:5:6:7:8")); 93 set.add(new InternetAddress("1:2:3:4:5:6:7:8"));
97 Expect.isTrue(set.contains(new InternetAddress("127.0.0.1"))); 94 Expect.isTrue(set.contains(new InternetAddress("127.0.0.1")));
98 Expect.isTrue(set.contains(InternetAddress.LOOPBACK_IP_V4)); 95 Expect.isTrue(set.contains(InternetAddress.LOOPBACK_IP_V4));
99 Expect.isFalse(set.contains(new InternetAddress("127.0.0.2"))); 96 Expect.isFalse(set.contains(new InternetAddress("127.0.0.2")));
100 Expect.isTrue(set.contains(new InternetAddress("::1"))); 97 Expect.isTrue(set.contains(new InternetAddress("::1")));
101 Expect.isTrue(set.contains(InternetAddress.LOOPBACK_IP_V6)); 98 Expect.isTrue(set.contains(InternetAddress.LOOPBACK_IP_V6));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 }); 133 });
137 } 134 }
138 135
139 void main() { 136 void main() {
140 testDefaultAddresses(); 137 testDefaultAddresses();
141 testConstructor(); 138 testConstructor();
142 testEquality(); 139 testEquality();
143 testLookup(); 140 testLookup();
144 testReverseLookup(); 141 testReverseLookup();
145 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698