Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: tests/corelib/collection_removes_test.dart

Issue 12401002: Make List.from and Iterable.toList default to not growable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/co19/co19-runtime.status ('k') | tests/corelib/list_growable_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(growable: true)); 89 testRemove(base.toList());
90 testRemove(base.toSet()); 90 testRemove(base.toSet());
91 91
92 var deltaSet = delta.toSet(); 92 var deltaSet = delta.toSet();
93 testRemoveAll(base.toList(growable: true), delta); 93 testRemoveAll(base.toList(), delta);
94 testRemoveAll(base.toList(growable: true), deltaSet); 94 testRemoveAll(base.toList(), deltaSet);
95 testRetainAll(base.toList(growable: true), delta); 95 testRetainAll(base.toList(), delta);
96 testRetainAll(base.toList(growable: true), deltaSet); 96 testRetainAll(base.toList(), deltaSet);
97 testRemoveMatching(base.toList(growable: true), deltaSet.contains); 97 testRemoveMatching(base.toList(), deltaSet.contains);
98 testRetainMatching(base.toList(growable: true), 98 testRetainMatching(base.toList(),
99 (e) => !deltaSet.contains(e)); 99 (e) => !deltaSet.contains(e));
100 100
101 testRemoveAll(base.toSet(), delta); 101 testRemoveAll(base.toSet(), delta);
102 testRemoveAll(base.toSet(), deltaSet); 102 testRemoveAll(base.toSet(), deltaSet);
103 testRetainAll(base.toSet(), delta); 103 testRetainAll(base.toSet(), delta);
104 testRetainAll(base.toSet(), deltaSet); 104 testRetainAll(base.toSet(), deltaSet);
105 testRemoveMatching(base.toSet(), deltaSet.contains); 105 testRemoveMatching(base.toSet(), deltaSet.contains);
106 testRetainMatching(base.toSet(), (e) => !deltaSet.contains(e)); 106 testRetainMatching(base.toSet(), (e) => !deltaSet.contains(e));
107 } 107 }
108 } 108 }
109 } 109 }
110 110
OLDNEW
« no previous file with comments | « tests/co19/co19-runtime.status ('k') | tests/corelib/list_growable_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698