Tests for ap-pipe and ap-compose

Added tests for the ap-pipe and ap-compose anaphoric macros.
This commit is contained in:
nicolas-p 2015-04-26 18:19:01 +02:00
parent d3d24db8bd
commit 3d667c179c

View File

@ -103,3 +103,13 @@
(assert-equal (ap-reduce (+ acc " on " it) ["Hy" "meth"])
"Hy on meth")
(assert-equal (ap-reduce (+ acc it) [] 1) 1))
(defn test-ap-pipe []
"NATIVE: testing anaphoric pipe"
(assert-equal (ap-pipe 2 (+ it 1) (* it 3)) 9)
(assert-equal (ap-pipe [4 5 6 7] (list (rest it)) (len it)) 3))
(defn test-ap-compose []
"NATIVE: testing anaphoric compose"
(assert-equal ((ap-compose (+ it 1) (* it 3)) 2) 9)
(assert-equal ((ap-compose (list (rest it)) (len it)) [4 5 6 7]) 3))