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

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

Issue 138953015: Fix bug in DoubleLinkedQueue where removing from empty queue throws. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | « sdk/lib/core/annotations.dart ('k') | no next file » | 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 queue.removeWhere((x) => x == 7); 231 queue.removeWhere((x) => x == 7);
232 testLength(26, queue); 232 testLength(26, queue);
233 233
234 queue.retainWhere((x) => x != 3); 234 queue.retainWhere((x) => x != 3);
235 testLength(23, queue); 235 testLength(23, queue);
236 236
237 Expect.listEquals( 237 Expect.listEquals(
238 [6, 8, 9, 1, 2, 4, 5, 6, 8, 9, 10, 1, 2, 4, 5, 6, 8, 9, 10, 1, 2, 4, 5], 238 [6, 8, 9, 1, 2, 4, 5, 6, 8, 9, 10, 1, 2, 4, 5, 6, 8, 9, 10, 1, 2, 4, 5],
239 queue.toList()); 239 queue.toList());
240
241 // Regression test: http://dartbug.com/16270
242 // These should all do nothing, and should not throw.
243 Queue emptyQueue = newQueue();
244 emptyQueue.remove(0);
245 emptyQueue.removeWhere((x) => null);
246 emptyQueue.retainWhere((x) => null);
240 } 247 }
241 248
242 void testLarge() { 249 void testLarge() {
243 int N = 10000; 250 int N = 10000;
244 Set set = new Set(); 251 Set set = new Set();
245 252
246 Queue queue = newQueue(); 253 Queue queue = newQueue();
247 Expect.isTrue(queue.isEmpty); 254 Expect.isTrue(queue.isEmpty);
248 255
249 for (int i = 0; i < N; i++) { 256 for (int i = 0; i < N; i++) {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 } 408 }
402 Expect.equals(null, entry2); 409 Expect.equals(null, entry2);
403 } 410 }
404 } 411 }
405 412
406 413
407 main() { 414 main() {
408 new DoubleLinkedQueueTest().testMain(); 415 new DoubleLinkedQueueTest().testMain();
409 new ListQueueTest().testMain(); 416 new ListQueueTest().testMain();
410 } 417 }
OLDNEW
« no previous file with comments | « sdk/lib/core/annotations.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698