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

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

Issue 2990623002: Migrate test block 9 to Dart 2.0 (Closed)
Patch Set: nits 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/hash_map_test.dart ('k') | tests/corelib_2/hash_set_type_check_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) 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 // VMOptions= 5 // VMOptions=
6 6
7 // Tests of hash set behavior, with focus in iteration and concurrent 7 // Tests of hash set behavior, with focus in iteration and concurrent
8 // modification errors. 8 // modification errors.
9 9
10 library hash_map2_test; 10 library hash_map2_test;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 set.add(1); // Integers are identical if equal. 294 set.add(1); // Integers are identical if equal.
295 Expect.equals(2, set.length); 295 Expect.equals(2, set.length);
296 var complex = 4; 296 var complex = 4;
297 complex = set.length == 2 ? complex ~/ 4 : 87; // Avoid compile-time constant. 297 complex = set.length == 2 ? complex ~/ 4 : 87; // Avoid compile-time constant.
298 Expect.isTrue(set.contains(complex)); // 1 is in set, even if computed. 298 Expect.isTrue(set.contains(complex)); // 1 is in set, even if computed.
299 set.clear(); 299 set.clear();
300 300
301 // All compile time constants are identical to themselves. 301 // All compile time constants are identical to themselves.
302 var constants = [ 302 var constants = [
303 double.INFINITY, 303 double.INFINITY,
304 double.NAN, -0.0, //# 01: ok 304 double.NAN, -0.0, //# 01: ok
305 0.0, 42, "", null, false, true, #bif, testIdentitySet 305 0.0, 42, "", null, false, true, #bif, testIdentitySet
306 ]; 306 ];
307 set.addAll(constants); 307 set.addAll(constants);
308 Expect.equals(constants.length, set.length); 308 Expect.equals(constants.length, set.length);
309 for (var c in constants) { 309 for (var c in constants) {
310 Expect.isTrue(set.contains(c), "constant: $c"); 310 Expect.isTrue(set.contains(c), "constant: $c");
311 } 311 }
312 Expect.isTrue(set.containsAll(constants), "constants: $set"); 312 Expect.isTrue(set.containsAll(constants), "constants: $set");
313 set.clear(); 313 set.clear();
314 314
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // Can't make a bad compareTo that isn't invalid. 354 // Can't make a bad compareTo that isn't invalid.
355 int compareTo(BadHashCode other) => id - other.id; 355 int compareTo(BadHashCode other) => id - other.id;
356 } 356 }
357 357
358 class Mutable { 358 class Mutable {
359 int id; 359 int id;
360 Mutable(this.id); 360 Mutable(this.id);
361 int get hashCode => id; 361 int get hashCode => id;
362 bool operator ==(other) => other is Mutable && id == other.id; 362 bool operator ==(other) => other is Mutable && id == other.id;
363 } 363 }
OLDNEW
« no previous file with comments | « tests/corelib_2/hash_map_test.dart ('k') | tests/corelib_2/hash_set_type_check_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698