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 testRemove(Collection base) { | 5 testRemove(Collection base) { |
6 int length = base.length; | 6 int length = base.length; |
7 for (int i = 0; i < length; i++) { | 7 for (int i = 0; i < length; i++) { |
8 Expect.isFalse(base.isEmpty); | 8 Expect.isFalse(base.isEmpty); |
9 base.remove(base.first); | 9 base.remove(base.first); |
10 } | 10 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 void main() { | 82 void main() { |
83 var collections = [ | 83 var collections = [ |
84 [], [1], [2], [1, 2], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | 84 [], [1], [2], [1, 2], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], |
85 [1, 3, 5, 7, 9], [2, 4, 6, 8, 10] | 85 [1, 3, 5, 7, 9], [2, 4, 6, 8, 10] |
86 ]; | 86 ]; |
87 for (var base in collections) { | 87 for (var base in collections) { |
88 for (var delta in collections) { | 88 for (var delta in collections) { |
89 testRemove(base.toList()); | 89 testRemove(base.toList(growable: true)); |
90 testRemove(base.toSet()); | 90 testRemove(base.toSet()); |
91 | 91 |
92 var deltaSet = delta.toSet(); | 92 var deltaSet = delta.toSet(); |
93 testRemoveAll(base.toList(), delta); | 93 testRemoveAll(base.toList(growable: true), delta); |
94 testRemoveAll(base.toList(), deltaSet); | 94 testRemoveAll(base.toList(growable: true), deltaSet); |
95 testRetainAll(base.toList(), delta); | 95 testRetainAll(base.toList(growable: true), delta); |
96 testRetainAll(base.toList(), deltaSet); | 96 testRetainAll(base.toList(growable: true), deltaSet); |
97 testRemoveMatching(base.toList(), deltaSet.contains); | 97 testRemoveMatching(base.toList(growable: true), deltaSet.contains); |
98 testRetainMatching(base.toList(), (e) => !deltaSet.contains(e)); | 98 testRetainMatching(base.toList(growable: true), |
| 99 (e) => !deltaSet.contains(e)); |
99 | 100 |
100 testRemoveAll(base.toSet(), delta); | 101 testRemoveAll(base.toSet(), delta); |
101 testRemoveAll(base.toSet(), deltaSet); | 102 testRemoveAll(base.toSet(), deltaSet); |
102 testRetainAll(base.toSet(), delta); | 103 testRetainAll(base.toSet(), delta); |
103 testRetainAll(base.toSet(), deltaSet); | 104 testRetainAll(base.toSet(), deltaSet); |
104 testRemoveMatching(base.toSet(), deltaSet.contains); | 105 testRemoveMatching(base.toSet(), deltaSet.contains); |
105 testRetainMatching(base.toSet(), (e) => !deltaSet.contains(e)); | 106 testRetainMatching(base.toSet(), (e) => !deltaSet.contains(e)); |
106 } | 107 } |
107 } | 108 } |
108 } | 109 } |
109 | 110 |
OLD | NEW |