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