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

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

Issue 9455051: Add getMinimum, getMaximum, getPreceding and getSucceeding to SplayTree. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: tests/corelib/src/SplayTreeTest.dart
===================================================================
--- tests/corelib/src/SplayTreeTest.dart (revision 4598)
+++ tests/corelib/src/SplayTreeTest.dart (working copy)
@@ -7,10 +7,10 @@
#import("dart:coreimpl");
-class SplayTreeTest {
+class SplayTreeMapTest {
static testMain() {
- SplayTree tree = new SplayTree();
+ SplayTreeMap tree = new SplayTreeMap();
tree[1] = "first";
tree[3] = "third";
tree[5] = "fifth";
@@ -24,9 +24,34 @@
Expect.equals(true, key <= 5);
Expect.equals(value, correctSolution[key - 1]);
});
+
+ for (var v in ["first", "second", "third", "fourth", "fifth"]) {
+ Expect.isTrue(tree.containsValue(v));
+ };
+ Expect.isFalse(tree.containsValue("sixth"));
+
+ tree[7] = "seventh";
+
+ Expect.equals(1, tree.firstKey);
+ Expect.equals(7, tree.lastKey);
+
+ Expect.equals(2, tree.lastKeyBefore(3));
+ Expect.equals(4, tree.firstKeyAfter(3));
+
+ Expect.equals(null, tree.lastKeyBefore(1));
+ Expect.equals(2, tree.firstKeyAfter(1));
+
+ Expect.equals(4, tree.lastKeyBefore(5));
+ Expect.equals(7, tree.firstKeyAfter(5));
+
+ Expect.equals(5, tree.lastKeyBefore(7));
+ Expect.equals(null, tree.firstKeyAfter(7));
+
+ Expect.equals(5, tree.lastKeyBefore(6));
+ Expect.equals(7, tree.firstKeyAfter(6));
}
}
main() {
- SplayTreeTest.testMain();
+ SplayTreeMapTest.testMain();
}
« corelib/src/implementation/splay_tree.dart ('K') | « corelib/src/implementation/splay_tree.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698