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

Unified Diff: tests/corelib/src/QueueTest.dart

Issue 9114021: Added method map to Collection interface and all its implementations (except classes generated fr... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/corelib/src/ListTest.dart ('k') | tests/corelib/src/RegExpAllMatchesTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/src/QueueTest.dart
===================================================================
--- tests/corelib/src/QueueTest.dart (revision 3161)
+++ tests/corelib/src/QueueTest.dart (working copy)
@@ -34,10 +34,21 @@
queue.removeFirst();
checkQueue(queue, 3, 1110);
+ int mapTest(int value) {
+ return value ~/ 10;
+ }
+
bool is10(int value) {
return (value == 10);
}
+ Queue mapped = queue.map(mapTest);
+ checkQueue(mapped, 3, 111);
+ checkQueue(queue, 3, 1110);
+ Expect.equals(1, mapped.removeFirst());
+ Expect.equals(100, mapped.removeLast());
+ Expect.equals(10, mapped.removeFirst());
+
Queue other = queue.filter(is10);
checkQueue(other, 1, 10);
@@ -155,8 +166,8 @@
}
static testQueueElements() {
- Queue<int> queue1 = new DoubleLinkedQueue<int>.from([1, 2, 4]);
- Queue<int> queue2 = new DoubleLinkedQueue<int>();
+ DoubleLinkedQueue<int> queue1 = new DoubleLinkedQueue<int>.from([1, 2, 4]);
+ DoubleLinkedQueue<int> queue2 = new DoubleLinkedQueue<int>();
queue2.addAll(queue1);
Expect.equals(queue1.length, queue2.length);
« no previous file with comments | « tests/corelib/src/ListTest.dart ('k') | tests/corelib/src/RegExpAllMatchesTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698