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 | 4 |
5 // Dart test for linked hash-maps. | 5 // Dart test for linked hash-maps. |
6 | 6 |
7 class LinkedHashMapTest { | 7 class LinkedHashMapTest { |
8 static void testMain() { | 8 static void testMain() { |
9 Map map = new LinkedHashMap(); | 9 Map map = new LinkedHashMap(); |
10 map["a"] = 1; | 10 map["a"] = 1; |
11 map["b"] = 2; | 11 map["b"] = 2; |
12 map["c"] = 3; | 12 map["c"] = 3; |
13 map["d"] = 4; | 13 map["d"] = 4; |
14 map["e"] = 5; | 14 map["e"] = 5; |
15 | 15 |
16 List<String> keys = new List<String>(5); | 16 List<String> keys = new List<String>.fixedLength(5); |
17 List<int> values = new List<int>(5); | 17 List<int> values = new List<int>.fixedLength(5); |
18 | 18 |
19 int index; | 19 int index; |
20 | 20 |
21 clear() { | 21 clear() { |
22 index = 0; | 22 index = 0; |
23 for (int i = 0; i < keys.length; i++) { | 23 for (int i = 0; i < keys.length; i++) { |
24 keys[i] = null; | 24 keys[i] = null; |
25 values[i] = null; | 25 values[i] = null; |
26 } | 26 } |
27 } | 27 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 clear(); | 105 clear(); |
106 map.values.forEach(testForEachValue); | 106 map.values.forEach(testForEachValue); |
107 verifyValues(valuesAfterAUpdate); | 107 verifyValues(valuesAfterAUpdate); |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 main() { | 111 main() { |
112 LinkedHashMapTest.testMain(); | 112 LinkedHashMapTest.testMain(); |
113 } | 113 } |
OLD | NEW |