cljs.spec/exercise-fn

MOVED, please see cljs.spec.alpha/exercise-fn
macroremoved v1.9.542added v1.9.183Edit
(exercise-fn sym)
(exercise-fn sym n)
(exercise-fn sym n fspec)

Source docstring:
exercises the fn named by sym (a symbol) by applying it to
n (default 10) generated samples of its args spec. When fspec is
supplied its arg spec is used, and sym-or-f can be a fn.  Returns a
sequence of tuples of [args ret]. 
Source code @ clojurescript:src/main/cljs/cljs/spec.cljc
(defmacro exercise-fn
  ([sym]
   `(exercise-fn ~sym 10))
  ([sym n]
   `(exercise-fn ~sym ~n nil))
  ([sym n fspec]
   (let [sym (cond-> sym
               (clojure.core/and (sequential? sym)
                                 (= (first sym) 'quote))
               second)]
     `(let [fspec# ~(if-not fspec
                      `(get-spec '~(:name (resolve &env sym)))
                      fspec)
            f#     ~sym]
        (for [args# (gen/sample (gen (:args fspec#)) ~n)]
          [args# (apply f# args#)])))))