Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Commit 855f394

Browse files
Seanrichhickey
authored andcommitted
Added test-empty-sorted to test_clojure/sequences.clj Refs #128
Signed-off-by: Rich Hickey <richhickey@gmail.com>
1 parent a3a1b3a commit 855f394

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/clojure/test_clojure/sequences.clj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@
146146
1.2 nil
147147
"abc" nil ))
148148

149+
;Tests that the comparator is preservered
150+
;The first element should be the same in each set if preserved.
151+
(deftest test-empty-sorted
152+
(let [inv-compare (comp - compare)]
153+
(are [x y] (= (first (into (empty x) x))
154+
(first y))
155+
(sorted-set 1 2 3) (sorted-set 1 2 3)
156+
(sorted-set-by inv-compare 1 2 3) (sorted-set-by inv-compare 1 2 3)
157+
158+
(sorted-map 1 :a 2 :b 3 :c) (sorted-map 1 :a 2 :b 3 :c)
159+
(sorted-map-by inv-compare 1 :a 2 :b 3 :c) (sorted-map-by inv-compare 1 :a 2 :b 3 :c))))
160+
149161

150162
(deftest test-not-empty
151163
; empty coll/seq => nil

0 commit comments

Comments
 (0)