OLD | NEW |
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 // A subtest of the larger MapTest. Will eliminate once the full | 4 // A subtest of the larger MapTest. Will eliminate once the full |
5 // test is running. | 5 // test is running. |
6 | 6 |
7 import "package:expect/expect.dart"; | |
8 | |
9 class MapTest { | 7 class MapTest { |
10 | 8 |
11 static void testDeletedElement(Map map) { | 9 static void testDeletedElement(Map map) { |
12 map.clear(); | 10 map.clear(); |
13 for (int i = 0; i < 100; i++) { | 11 for (int i = 0; i < 100; i++) { |
14 map[1] = 2; | 12 map[1] = 2; |
15 Expect.equals(1, map.length); | 13 Expect.equals(1, map.length); |
16 int x = map.remove(1); | 14 int x = map.remove(1); |
17 Expect.equals(2, x); | 15 Expect.equals(2, x); |
18 Expect.equals(0, map.length); | 16 Expect.equals(0, map.length); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 static testMain() { | 212 static testMain() { |
215 test(new Map()); | 213 test(new Map()); |
216 testKeys(new Map()); | 214 testKeys(new Map()); |
217 } | 215 } |
218 } | 216 } |
219 | 217 |
220 | 218 |
221 main() { | 219 main() { |
222 MapTest.testMain(); | 220 MapTest.testMain(); |
223 } | 221 } |
OLD | NEW |