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

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

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
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 class SetTest { 5 class SetTest {
6 6
7 static testMain() { 7 static testMain() {
8 Set set = new Set(); 8 Set set = new Set();
9 Expect.equals(0, set.length); 9 Expect.equals(0, set.length);
10 set.add(1); 10 set.add(1);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 Expect.equals(false, intersection.contains(9)); 131 Expect.equals(false, intersection.contains(9));
132 Expect.equals(false, intersection.contains(10)); 132 Expect.equals(false, intersection.contains(10));
133 Expect.equals(4, intersection.length); 133 Expect.equals(4, intersection.length);
134 134
135 Expect.equals(true, set.containsAll(intersection)); 135 Expect.equals(true, set.containsAll(intersection));
136 Expect.equals(true, filtered.containsAll(intersection)); 136 Expect.equals(true, filtered.containsAll(intersection));
137 Expect.equals(true, intersection.isSubsetOf(set)); 137 Expect.equals(true, intersection.isSubsetOf(set));
138 Expect.equals(true, intersection.isSubsetOf(filtered)); 138 Expect.equals(true, intersection.isSubsetOf(filtered));
139 139
140 // Test Set.addAll. 140 // Test Set.addAll.
141 List list = new List.fixedLength(10); 141 List list = new List(10);
142 for (int i = 0; i < 10; i++) { 142 for (int i = 0; i < 10; i++) {
143 list[i] = i + 10; 143 list[i] = i + 10;
144 } 144 }
145 set.addAll(list); 145 set.addAll(list);
146 Expect.equals(20, set.length); 146 Expect.equals(20, set.length);
147 for (int i = 0; i < 20; i++) { 147 for (int i = 0; i < 20; i++) {
148 Expect.equals(true, set.contains(i)); 148 Expect.equals(true, set.contains(i));
149 } 149 }
150 150
151 // Test Set.removeAll 151 // Test Set.removeAll
(...skipping 10 matching lines...) Expand all
162 set.clear(); 162 set.clear();
163 Expect.equals(0, set.length); 163 Expect.equals(0, set.length);
164 set.add(11); 164 set.add(11);
165 Expect.equals(1, set.length); 165 Expect.equals(1, set.length);
166 } 166 }
167 } 167 }
168 168
169 main() { 169 main() {
170 SetTest.testMain(); 170 SetTest.testMain();
171 } 171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698