Merge pull request #161 from hellerve/test-sort

Add test case for sort
This commit is contained in:
Erik Svedäng 2018-01-10 20:51:03 +01:00 committed by GitHub
commit 2cacc516cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,11 @@
(defn inc-ref [x] (+ @x 1))
(defn cmp [a b]
(if (= @a @b)
0
(if (> @a @b) 1 -1)))
(defn main []
(let [a (range 0 9 1)
b (Array.replicate 5 "Hi")]
@ -91,6 +96,11 @@
&(range 10 1 -2)
"range backwards works as expected if we dont exactly hit"
)
(assert-equal test
&[1 2 3 4 5 6 7 8 9]
(sort &(range 9 1 -1) cmp)
"sort works as expected"
)
(assert-equal test
&[@"Hi!" @"Hi!" @"Hi!" @"Hi!" @"Hi!"]
&(endo-map excl b)