(checking name & opt+body)
A macro intended to replace the testing macro in clojure.test with a generative form. To make
(testing "doubling" (is (= (* 2 2) (+ 2 2))))
generative, you simply have to change it to
(checking "doubling" [x gen/int] (is (= (* 2 x) (+ x x)))).
Test failures will be reported for the smallest case only.
Bindings and body are passed to com.gfredericks.test.chuck.properties/for-all.
Options can be provided to clojure.test.check/quick-check
as an optional
second argument, and should either evaluate to an integer (number of tests) or a
map (with :num-tests specifying the number of tests). e.g.:
(let [options {:num-tests 100 :seed 123 :max-size 10}] (checking "doubling" options [x gen/int] (is (= (* 2 x) (+ x x)))))
For background, see http://blog.colinwilliams.name/blog/2015/01/26/alternative-clojure-dot-test-integration-with-test-dot-check/
A macro intended to replace the testing macro in clojure.test with a generative form. To make (testing "doubling" (is (= (* 2 2) (+ 2 2)))) generative, you simply have to change it to (checking "doubling" [x gen/int] (is (= (* 2 x) (+ x x)))). Test failures will be reported for the smallest case only. Bindings and body are passed to com.gfredericks.test.chuck.properties/for-all. Options can be provided to `clojure.test.check/quick-check` as an optional second argument, and should either evaluate to an integer (number of tests) or a map (with :num-tests specifying the number of tests). e.g.: (let [options {:num-tests 100 :seed 123 :max-size 10}] (checking "doubling" options [x gen/int] (is (= (* 2 x) (+ x x))))) For background, see http://blog.colinwilliams.name/blog/2015/01/26/alternative-clojure-dot-test-integration-with-test-dot-check/
(for-all bindings & body)
An alternative to com.gfredericks.test.chuck.properties/for-all that uses clojure.test-style assertions (i.e., clojure.test/is) rather than the truthiness of the body expression.
See checking
to additionally report clojure.test assertion failures.
An alternative to com.gfredericks.test.chuck.properties/for-all that uses clojure.test-style assertions (i.e., clojure.test/is) rather than the truthiness of the body expression. See `checking` to additionally report clojure.test assertion failures.
(qc-and-report-exception final-reports num-tests-or-options bindings & body)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close