Generate tests using detected constants and write-test.

This commit is contained in:
Chris Ford 2014-04-02 21:01:24 +01:00
parent bf29efecb3
commit d5f5b90ab8

View file

@ -7,11 +7,15 @@
(defn testgen [fndef] nil) (defn testgen [fndef] nil)
(defn is-constant? [x] (not (symbol? x))) (defn constant? [x] (not (symbol? x)))
(defn constants [form] (defn constants [form]
(filter is-constant? (flatten form))) (filter constant? (flatten form)))
(defn gen-tests [fnname form]
(map (partial write-test fnname) (constants form)))
(comment (comment
(constants '(fn is-four [x] (= 88 [44]))) (def is-four (fn is-four [x] (= 88 [44])))
(gen-tests 'is-four '(fn is-four [x] (= 88 [44])))
) )