Liking cljdoc? Tell your friends :D
Mostly clj/s.
Exceptions indicated.

clojure.test.check.properties


ErrorResultcljs

source

for-allclj/smacro

(for-all bindings & body)

Returns a property, which is the combination of some generators and an assertion that should be true for all generated values. Properties can be used with quick-check or defspec.

for-all takes a let-style bindings vector, where the right-hand side of each binding is a generator.

The body should be an expression of the generated values that will be tested for truthiness, unless it is a special implementation of the clojure.test.check.results/Result protocol. Exceptions in the body will be caught and treated as failures.

When there are multiple binding pairs, the earlier pairs are not visible to the later pairs.

If there are multiple body expressions, all but the last one are executed for side effects, as with do.

Example:

(for-all [a gen/large-integer b gen/large-integer] (>= (+ a b) a))

Returns a property, which is the combination of some generators and
an assertion that should be true for all generated values. Properties
can be used with `quick-check` or `defspec`.

`for-all` takes a `let`-style bindings vector, where the right-hand
side of each binding is a generator.

The body should be an expression of the generated values that will
be tested for truthiness, unless it is a special implementation of
the clojure.test.check.results/Result protocol. Exceptions in the
body will be caught and treated as failures.

When there are multiple binding pairs, the earlier pairs are not
visible to the later pairs.

If there are multiple body expressions, all but the last one are
executed for side effects, as with `do`.

Example:

(for-all [a gen/large-integer
          b gen/large-integer]
  (>= (+ a b) a))
source (clj)source (cljs)raw docstring

for-all*clj/s

(for-all* args function)

A function version of for-all. Takes a sequence of N generators and a function of N args, and returns a property that calls the function with generated values and tests the return value for truthiness, like with for-all.

Example:

(for-all* [gen/large-integer gen/large-integer] (fn [a b] (>= (+ a b) a)))

A function version of `for-all`. Takes a sequence of N generators
and a function of N args, and returns a property that calls the
function with generated values and tests the return value for
truthiness, like with `for-all`.

Example:

(for-all* [gen/large-integer gen/large-integer]
          (fn [a b] (>= (+ a b) a)))
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close