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

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

Issue 14425003: Make List.remove return boolean. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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/corelib/list_test.dart ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('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 library queue.test; 5 library queue.test;
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 abstract class QueueTest { 10 abstract class QueueTest {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 for (int i = 1; i <= 5; i++) { 215 for (int i = 1; i <= 5; i++) {
216 Expect.equals(i, queue.removeFirst()); 216 Expect.equals(i, queue.removeFirst());
217 testLength(40 - i, queue); 217 testLength(40 - i, queue);
218 } 218 }
219 219
220 for (int i = 1; i <= 5; i++) { 220 for (int i = 1; i <= 5; i++) {
221 Expect.equals(11 - i, queue.removeLast()); 221 Expect.equals(11 - i, queue.removeLast());
222 testLength(35 - i, queue); 222 testLength(35 - i, queue);
223 } 223 }
224 224
225 queue.remove(10); 225 Expect.isTrue(queue.remove(10));
226 testLength(29, queue);
227 Expect.isFalse(queue.remove(999));
226 testLength(29, queue); 228 testLength(29, queue);
227 229
228 queue.removeWhere((x) => x == 7); 230 queue.removeWhere((x) => x == 7);
229 testLength(26, queue); 231 testLength(26, queue);
230 232
231 queue.retainWhere((x) => x != 3); 233 queue.retainWhere((x) => x != 3);
232 testLength(23, queue); 234 testLength(23, queue);
233 235
234 Expect.listEquals( 236 Expect.listEquals(
235 [6, 8, 9, 1, 2, 4, 5, 6, 8, 9, 10, 1, 2, 4, 5, 6, 8, 9, 10, 1, 2, 4, 5], 237 [6, 8, 9, 1, 2, 4, 5, 6, 8, 9, 10, 1, 2, 4, 5, 6, 8, 9, 10, 1, 2, 4, 5],
(...skipping 24 matching lines...) Expand all
260 Expect.equals(-i, mapped.first); 262 Expect.equals(-i, mapped.first);
261 Expect.equals(i + 1, skip1.first); 263 Expect.equals(i + 1, skip1.first);
262 Expect.equals(i, queue.removeFirst()); 264 Expect.equals(i, queue.removeFirst());
263 Expect.equals(i + 1, take1.first); 265 Expect.equals(i + 1, take1.first);
264 Expect.equals(-i - 1, mapped.first); 266 Expect.equals(-i - 1, mapped.first);
265 Expect.equals(N - 1 - i, queue.last); 267 Expect.equals(N - 1 - i, queue.last);
266 Expect.equals(N - 1 - i, queue.removeLast()); 268 Expect.equals(N - 1 - i, queue.removeLast());
267 } 269 }
268 Expect.equals(N - 1000, queue.length); 270 Expect.equals(N - 1000, queue.length);
269 271
270 queue.remove(N >> 1); 272 Expect.isTrue(queue.remove(N >> 1));
271 Expect.equals(N - 1001, queue.length); 273 Expect.equals(N - 1001, queue.length);
272 274
273 queue.clear(); 275 queue.clear();
274 Expect.equals(0, queue.length); 276 Expect.equals(0, queue.length);
275 Expect.isTrue(queue.isEmpty); 277 Expect.isTrue(queue.isEmpty);
276 278
277 queue.addAll(set); 279 queue.addAll(set);
278 Expect.equals(N, queue.length); 280 Expect.equals(N, queue.length);
279 Expect.isFalse(queue.isEmpty); 281 Expect.isFalse(queue.isEmpty);
280 282
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 400 }
399 Expect.equals(null, entry2); 401 Expect.equals(null, entry2);
400 } 402 }
401 } 403 }
402 404
403 405
404 main() { 406 main() {
405 new DoubleLinkedQueueTest().testMain(); 407 new DoubleLinkedQueueTest().testMain();
406 new ListQueueTest().testMain(); 408 new ListQueueTest().testMain();
407 } 409 }
OLDNEW
« no previous file with comments | « tests/corelib/list_test.dart ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698