Source

ClojureCheck / src / main / clojure / clojurecheck / core.clj

Diff from to

File src/main/clojure/clojurecheck/core.clj

   (generators {chs (list characters :length length)}
     (apply str chs)))
 
+;; ## Generator transformers
 (defn transform
   "Generates a value according to `gen` and calls `f` with the generated
   value—not the domain value. The return value of `f` becomes the new
                     (some (fn [[c f]] (when (< dice f) c)) choices)))]
     (reify
       Generator
-      (arbitrary [this size] (arbitrary (choose) size)))))
+      (arbitrary [this size] (generate (choose) size)))))
 
 (defn one-of
   "Chooses one of the given generators with equal probability.
     Generator
     (arbitrary
       [this size]
-      (when-let [dom-value (arbitrary generator size)]
-        (when (pred (.value dom-value))
-          dom-value)))))
+      (when-let [dval (arbitrary generator size)]
+        (when (pred (value dval))
+          dval)))))
 
 (defn sized
   "Modify the size guidance according to f and pass it on to the
       (reset! results [])
       (if (< *trials* n)
         (report {:type :pass})
-        (let [input (->> n *size-scale* (generate-input gen))]
+        (let [input (->> n *size-scale* (generate gen))]
           (try
             (binding [report report-fn]
-              (prop (.value input)))
+              (prop (value input)))
             (let [failures (filter #(-> % :type (not= :pass)) @results)]
               (when-let [failures (seq failures)]
                 (do-report {:type     ::property-fail
                             :message  msg
                             :locals   locals
-                            :input    (.value input)
+                            :input    (value input)
                             :attempts n
                             :failures failures})))
             (catch Throwable t
               (do-report {:type    ::property-error
                           :message msg
                           :locals  locals
-                          :input   (.value input)
+                          :input   (value input)
                           :error   t})))
           (recur (inc n)))))))