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

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

Issue 2765693002: Update all tests (Closed)
Patch Set: Created 3 years, 9 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 // 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 set.add(2); 278 set.add(2);
279 set.add(1); // Integers are identical if equal. 279 set.add(1); // Integers are identical if equal.
280 Expect.equals(2, set.length); 280 Expect.equals(2, set.length);
281 var complex = 4; 281 var complex = 4;
282 complex = set.length == 2 ? complex ~/ 4 : 87; // Avoid compile-time constant . 282 complex = set.length == 2 ? complex ~/ 4 : 87; // Avoid compile-time constant .
283 Expect.isTrue(set.contains(complex)); // 1 is in set, even if computed. 283 Expect.isTrue(set.contains(complex)); // 1 is in set, even if computed.
284 set.clear(); 284 set.clear();
285 285
286 // All compile time constants are identical to themselves. 286 // All compile time constants are identical to themselves.
287 var constants = [double.INFINITY, 287 var constants = [double.INFINITY,
288 double.NAN, -0.0, /// 01: ok 288 double.NAN, -0.0, //# 01: ok
289 0.0, 42, "", null, false, true, #bif, testIdentitySet]; 289 0.0, 42, "", null, false, true, #bif, testIdentitySet];
290 set.addAll(constants); 290 set.addAll(constants);
291 Expect.equals(constants.length, set.length); 291 Expect.equals(constants.length, set.length);
292 for (var c in constants) { 292 for (var c in constants) {
293 Expect.isTrue(set.contains(c), "constant: $c"); 293 Expect.isTrue(set.contains(c), "constant: $c");
294 } 294 }
295 Expect.isTrue(set.containsAll(constants), "constants: $set"); 295 Expect.isTrue(set.containsAll(constants), "constants: $set");
296 set.clear(); 296 set.clear();
297 297
298 var m1 = new Mutable(1); 298 var m1 = new Mutable(1);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 // Can't make a bad compareTo that isn't invalid. 340 // Can't make a bad compareTo that isn't invalid.
341 int compareTo(BadHashCode other) => id - other.id; 341 int compareTo(BadHashCode other) => id - other.id;
342 } 342 }
343 343
344 class Mutable { 344 class Mutable {
345 int id; 345 int id;
346 Mutable(this.id); 346 Mutable(this.id);
347 int get hashCode => id; 347 int get hashCode => id;
348 bool operator==(other) => other is Mutable && id == other.id; 348 bool operator==(other) => other is Mutable && id == other.id;
349 } 349 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698