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