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 import "package:expect/expect.dart"; |
| 6 |
5 void testListMapCorrespondence(List list, Map map) { | 7 void testListMapCorrespondence(List list, Map map) { |
6 Expect.equals(list.length, map.length); | 8 Expect.equals(list.length, map.length); |
7 for (int i = 0; i < list.length; i++) { | 9 for (int i = 0; i < list.length; i++) { |
8 Expect.equals(list[i], map[i]); | 10 Expect.equals(list[i], map[i]); |
9 } | 11 } |
10 Expect.isNull(map[list.length]); | 12 Expect.isNull(map[list.length]); |
11 Expect.isNull(map[-1]); | 13 Expect.isNull(map[-1]); |
12 | 14 |
13 Iterable keys = map.keys; | 15 Iterable keys = map.keys; |
14 Iterable values = map.values; | 16 Iterable values = map.values; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 testConstAsMap(const [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); | 89 testConstAsMap(const [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); |
88 testAsMap([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); | 90 testAsMap([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); |
89 List list = new List(10); | 91 List list = new List(10); |
90 for (int i = 0; i < 10; i++) list[i] = i + 1; | 92 for (int i = 0; i < 10; i++) list[i] = i + 1; |
91 testFixedAsMap(list); | 93 testFixedAsMap(list); |
92 | 94 |
93 testConstAsMap(const []); | 95 testConstAsMap(const []); |
94 testAsMap([]); | 96 testAsMap([]); |
95 testFixedAsMap(new List(0)); | 97 testFixedAsMap(new List(0)); |
96 } | 98 } |
OLD | NEW |