From 855f394d6895cebfcee307dbccea9bdeffe792f5 Mon Sep 17 00:00:00 2001 From: Sean Date: Sat, 19 Dec 2009 01:17:24 -0500 Subject: Added test-empty-sorted to test_clojure/sequences.clj Refs #128 Signed-off-by: Rich Hickey --- test/clojure/test_clojure/sequences.clj | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/clojure/test_clojure/sequences.clj b/test/clojure/test_clojure/sequences.clj index 3ea03252..6aa3c695 100644 --- a/test/clojure/test_clojure/sequences.clj +++ b/test/clojure/test_clojure/sequences.clj @@ -146,6 +146,18 @@ 1.2 nil "abc" nil )) +;Tests that the comparator is preservered +;The first element should be the same in each set if preserved. +(deftest test-empty-sorted + (let [inv-compare (comp - compare)] + (are [x y] (= (first (into (empty x) x)) + (first y)) + (sorted-set 1 2 3) (sorted-set 1 2 3) + (sorted-set-by inv-compare 1 2 3) (sorted-set-by inv-compare 1 2 3) + + (sorted-map 1 :a 2 :b 3 :c) (sorted-map 1 :a 2 :b 3 :c) + (sorted-map-by inv-compare 1 :a 2 :b 3 :c) (sorted-map-by inv-compare 1 :a 2 :b 3 :c)))) + (deftest test-not-empty ; empty coll/seq => nil -- cgit v1.2.3-70-g09d2