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

Side by Side Diff: tests/corelib_2/set_test.dart

Issue 2987773002: Migrated test block 25 to Dart 2.0. (Closed)
Patch Set: Removed changes to migrate_batch.dart Created 3 years, 4 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
« no previous file with comments | « tests/corelib_2/set_retainAll_test.dart ('k') | tests/corelib_2/set_to_string_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 library set_test; 5 library set_test;
6 6
7 import 'package:expect/expect.dart'; 7 import 'package:expect/expect.dart';
8 import "dart:collection"; 8 import "dart:collection";
9 9
10 void testMain(Set create()) { 10 void testMain(Set create()) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 159
160 // Test Set.difference. 160 // Test Set.difference.
161 Set difference = twice.difference(thrice); 161 Set difference = twice.difference(thrice);
162 Expect.equals(5, difference.length); 162 Expect.equals(5, difference.length);
163 for (int i = 0; i < 16; i++) { 163 for (int i = 0; i < 16; i++) {
164 Expect.equals(i.isEven && (i % 3) != 0, difference.contains(i)); 164 Expect.equals(i.isEven && (i % 3) != 0, difference.contains(i));
165 } 165 }
166 Expect.isTrue(twice.difference(thrice).difference(twice).isEmpty); 166 Expect.isTrue(twice.difference(thrice).difference(twice).isEmpty);
167 167
168 // Test Set.difference with non-element type.
169 Set diffSet = create()..addAll([0, 1, 2, 499, 999]);
170 Set<Object> objectSet = new Set<Object>();
171 objectSet.add("foo");
172 objectSet.add(499);
173 Set diffResult = diffSet.difference(objectSet);
174 Expect.equals(4, diffResult.length);
175 for (int value in [0, 1, 2, 999]) {
176 Expect.isTrue(diffResult.contains(value));
177 }
178
168 // Test Set.addAll. 179 // Test Set.addAll.
169 List list = new List(10); 180 List list = new List(10);
170 for (int i = 0; i < 10; i++) { 181 for (int i = 0; i < 10; i++) {
171 list[i] = i + 10; 182 list[i] = i + 10;
172 } 183 }
173 set.addAll(list); 184 set.addAll(list);
174 testLength(20, set); 185 testLength(20, set);
175 for (int i = 0; i < 20; i++) { 186 for (int i = 0; i < 20; i++) {
176 Expect.isTrue(set.contains(i)); 187 Expect.isTrue(set.contains(i));
177 } 188 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 547
537 testCESetFrom( 548 testCESetFrom(
538 (x) => new SplayTreeSet<CE>.from(x, customCompare(20), validKey)); 549 (x) => new SplayTreeSet<CE>.from(x, customCompare(20), validKey));
539 testCESetFrom((x) => new SplayTreeSet<CE>.from(x, identityCompare)); 550 testCESetFrom((x) => new SplayTreeSet<CE>.from(x, identityCompare));
540 551
541 testASetFrom((x) => new Set<A>.from(x)); 552 testASetFrom((x) => new Set<A>.from(x));
542 testASetFrom((x) => new HashSet<A>.from(x)); 553 testASetFrom((x) => new HashSet<A>.from(x));
543 testASetFrom((x) => new LinkedHashSet<A>.from(x)); 554 testASetFrom((x) => new LinkedHashSet<A>.from(x));
544 testASetFrom((x) => new SplayTreeSet<A>.from(x, identityCompare)); 555 testASetFrom((x) => new SplayTreeSet<A>.from(x, identityCompare));
545 } 556 }
OLDNEW
« no previous file with comments | « tests/corelib_2/set_retainAll_test.dart ('k') | tests/corelib_2/set_to_string_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698