| 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 // Tests of hash set behavior, with focus in iteration and concurrent | 5 // Tests of hash set behavior, with focus in iteration and concurrent |
| 6 // modification errors. | 6 // modification errors. |
| 7 | 7 |
| 8 library hash_map2_test; | 8 library hash_map2_test; |
| 9 import "package:expect/expect.dart"; |
| 9 import 'dart:collection'; | 10 import 'dart:collection'; |
| 10 | 11 |
| 11 testSet(Set newSet(), Set newSetFrom(Set from)) { | 12 testSet(Set newSet(), Set newSetFrom(Set from)) { |
| 12 Set gen(int from, int to) => | 13 Set gen(int from, int to) => |
| 13 new Set.from(new Iterable.generate(to - from, (n) => n + from)); | 14 new Set.from(new Iterable.generate(to - from, (n) => n + from)); |
| 14 | 15 |
| 15 bool odd(int n) => (n & 1) == 1; | 16 bool odd(int n) => (n & 1) == 1; |
| 16 bool even(int n) => (n & 1) == 0; | 17 bool even(int n) => (n & 1) == 0; |
| 17 | 18 |
| 18 { // Test growing to largish capacity. | 19 { // Test growing to largish capacity. |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 198 |
| 198 class BadHashCode { | 199 class BadHashCode { |
| 199 static int idCounter = 0; | 200 static int idCounter = 0; |
| 200 final int id; | 201 final int id; |
| 201 BadHashCode() : id = idCounter++; | 202 BadHashCode() : id = idCounter++; |
| 202 int get hashCode => 42; | 203 int get hashCode => 42; |
| 203 // operator == is identity. | 204 // operator == is identity. |
| 204 // Can't make a bad compareTo that isn't invalid. | 205 // Can't make a bad compareTo that isn't invalid. |
| 205 int compareTo(BadHashCode other) => id - other.id; | 206 int compareTo(BadHashCode other) => id - other.id; |
| 206 } | 207 } |
| OLD | NEW |