Change name; add a test spec.
This commit is contained in:
parent
c34e900427
commit
60bf33ffab
2 changed files with 13 additions and 3 deletions
|
|
@ -270,11 +270,11 @@
|
|||
(next-fn (afn structure))
|
||||
))
|
||||
|
||||
(defpath biview [afn bfn]
|
||||
(defpath parser [parse unparse]
|
||||
(select* [this structure next-fn]
|
||||
(next-fn (afn structure)))
|
||||
(next-fn (parse structure)))
|
||||
(transform* [this structure next-fn]
|
||||
(bfn (next-fn (afn structure)))
|
||||
(unparse (next-fn (parse structure)))
|
||||
))
|
||||
|
||||
(defn selected?
|
||||
|
|
|
|||
|
|
@ -242,6 +242,16 @@
|
|||
(s/transform (s/view afn) identity i)
|
||||
)))
|
||||
|
||||
(defspec parser-test
|
||||
(for-all+
|
||||
[i gen/int
|
||||
j gen/int]
|
||||
(and (= (first (s/select (s/parser #(+ % j) #(- % j)) i))
|
||||
(+ j i))
|
||||
(= (s/transform (s/parser #(+ % j) #(- % j)) identity i)
|
||||
i)
|
||||
)))
|
||||
|
||||
(deftest selected?-test
|
||||
(is (= [[1 3 5] [2 :a] [7 11 4 2 :a] [10 1 :a] []]
|
||||
(s/setval [s/ALL (s/selected? s/ALL even?) s/END]
|
||||
|
|
|
|||
Loading…
Reference in a new issue