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

Unified Diff: tests/corelib/hash_set_test.dart

Issue 13913005: Implement JS version of LinkedHashSet and move the various HashTable implementations to the VM coll… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Map -> 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/collection/linked_hash_table.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/hash_set_test.dart
diff --git a/tests/corelib/hash_set_test.dart b/tests/corelib/hash_set_test.dart
index 29e2606cfa657d2cd7075ea54f07fab70f5194bf..ee4bd16df88a0820e133c5c5188bab7be5502a90 100644
--- a/tests/corelib/hash_set_test.dart
+++ b/tests/corelib/hash_set_test.dart
@@ -188,6 +188,34 @@ testSet(Set newSet(), Set newSetFrom(Set from)) {
Expect.equals(127, set.length);
Expect.isFalse(set.contains(null));
}
+
+ { // Check that addAll and clear works.
+ Set set = newSet();
+ set.addAll([]);
+ Expect.isTrue(set.isEmpty);
+ set.addAll([1, 3, 2]);
+ Expect.equals(3, set.length);
+ Expect.isTrue(set.contains(1));
+ Expect.isTrue(set.contains(3));
+ Expect.isTrue(set.contains(2));
+ Expect.isFalse(set.contains(4));
+ set.clear();
+ Expect.isTrue(set.isEmpty);
+ }
+
+ { // Check that removeWhere and retainWhere work.
+ Set set = newSetFrom([1, 2, 3]);
+ set.removeWhere((each) => each == 2);
+ Expect.equals(2, set.length);
+ Expect.isTrue(set.contains(1));
+ Expect.isFalse(set.contains(2));
+ Expect.isTrue(set.contains(3));
+ set.retainWhere((each) => each == 3);
+ Expect.equals(1, set.length);
+ Expect.isFalse(set.contains(1));
+ Expect.isFalse(set.contains(2));
+ Expect.isTrue(set.contains(3));
+ }
}
void main() {
« no previous file with comments | « sdk/lib/collection/linked_hash_table.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698