clojure.test.check.generators
-
Positional factory function for class clojure.test.check.generators.Generator.
function([gen])
A
A recursive generator that will generate many different, often nested, values
valueLike any, but only generates objects that can be equal to other objects (e.g., do not contain a NaN)
valueLike any, but avoids characters that the shell will interpret as actions, like 7 and 14 (bell and alternate character ...
valueLike any, but avoids characters that the shell will interpret as actions, like 7 and 14 (bell and alternate character ...
value
B
Generates a ratio (or integer) using gen/size-bounded-bigint. Shrinks toward simpler ratios, which may be larger or sm...
valueCreates a new generator that passes the result of `gen` into function `f`. `f` should return a new generator. This all...
function([generator f])
Generates one of `true` or `false`. Shrinks to `false`.
valueGenerates `java.lang.Byte`s, using the full byte-range.
valueGenerates byte-arrays.
value
C
Internal function.
function([{generator-fn :gen} rnd size])
Generates character from 0-255.
valueGenerates alpha characters.
valueDeprecated - use char-alphanumeric instead. Generates alphanumeric characters.
valueGenerates alphanumeric characters.
valueGenerates only ascii characters.
valueCreates a generator that generates integers uniformly in the range `lower` to `upper`, inclusive. (gen/sa...
function([lower upper])
- function
([inner-type])
D
Generates 64-bit floating point numbers from the entire range, including +/- infinity and NaN. Use double* for more co...
valueGenerates a 64-bit floating point number. Options: :infinite? - whether +/- infinity can be generated (default true...
function([{:keys [infinite? NaN? min max], :or {infinite? true, NaN? true}}])
E
Creates a generator that randomly chooses an element from `coll`. (gen/sample (gen/elements [:foo :bar :baz])) ...
function([coll])
F
G
Internal function.
function([{h :gen} k])
Internal function.
function([k {h :gen}])
Internal function.
function([value])
Returns a single sample value from the generator. Note that this function is a dev helper and is not meant to be used...
function([generator] [generator size] [generator size seed])
Test if `x` is a generator. Generators should be treated as opaque values.
function([x])
H
Like clojure.core/hash-map, except the values are generators. Returns a generator that makes maps with the supplied k...
function([& kvs])
I
Deprecated - use gen/small-integer instead. Generates a positive or negative integer bounded by the generator's `si...
value
K
Generates keywords without namespaces.
valueGenerates keywords with namespaces.
value
L
Generates a platform-native integer from the full available range (in clj, 64-bit Longs, and in cljs, numbers between ...
valueLike large-integer, but accepts options: :min the minimum integer (inclusive) :max the maximum integer (inclu...
function([{:keys [min max]}])
Internal function. Given a random number generator, returns an infinite lazy sequence of random number generators.
function([rr])
Macro for building generators using values from other generators. Uses a binding vector with the same syntax as clojur...
macro([bindings & body])
Like `vector`, but generates lists.
function([generator])
Generates a list of elements from the given generator, with the guarantee that the elements will be distinct. If th...
function([gen] [gen opts])
Generates a list of elements from the given generator, with the guarantee that (map key-fn the-list) will be distinct....
function([key-fn gen] [key-fn gen opts])
M
Internal function.
function([max-size])
Creates a generator that generates maps, with keys chosen from `key-gen` and values chosen from `val-gen`. If the k...
function([key-gen val-gen] [key-gen val-gen opts])
Factory function for class clojure.test.check.generators.Generator, taking a map of keywords to field values.
function([m__8001__auto__])
N
Generates non-negative integers bounded by the generator's `size` parameter. Shrinks to zero.
valueDeprecated - use (gen/fmap - gen/nat) instead (see also gen/large-integer). (this generator, despite its name, can ge...
valueCreates a new generator that is just like `gen`, except does not shrink at all. This can be useful when shrinking is t...
function([gen])
Modifies a generator so that it doesn't generate empty collections. Examples: ;; generate a vector of booleans...
function([gen])
O
Creates a generator that randomly chooses a value from the list of provided generators. Shrinks toward choosing an ear...
function([generators])
P
Deprecated - use gen/nat instead (see also gen/large-integer). (this generator, despite its name, can generate 0) ...
value
R
Generates a small ratio (or integer) using gen/small-integer. Shrinks toward simpler ratios, which may be larger or sm...
valueThis is a helper for writing recursive (tree-shaped) generators. The first argument should be a function that takes a ...
function([container-gen-fn scalar-gen])
Creates a new generator with `size` always bound to `n`. (gen/sample (gen/set (gen/resize 200 gen/double))) ...
function([n generator])
Creates a generator that always returns `value`, and never shrinks. You can think of this as the `constantly` of gen...
function([value])
S
Deprecated - use (gen/fmap (comp dec -) gen/nat) instead (see also gen/large-integer). Generates negative integers bo...
valueDeprecated - use (gen/fmap inc gen/nat) instead (see also gen/large-integer). Generates positive integers bounded by ...
valueReturn a sequence of `num-samples` (default 10) realized values from `generator`. The sequence starts with small va...
function([generator] [generator num-samples])
Returns an infinite sequence of realized values from `generator`. Note that this function is a dev helper and is not ...
function([generator] [generator max-size])
Creates a new generator that modifies the size parameter by the given function. Intended to support generators with si...
function([f generator])
Generates a set of elements from the given generator. If the generator cannot or is unlikely to produce enough distin...
function([gen] [gen opts])
Creates a new generator like `gen`, but will consider nodes for shrinking even if their parent passes the test (up to ...
function([gen])
Creates a generator that generates random permutations of `coll`. Shrinks toward the original collection: `coll`. `col...
function([coll])
Generates a variety of scalar types.
valueLike gen/simple-type, but only generates objects that can be equal to other objects (e.g., not a NaN).
valueGenerates a variety of scalar types, with printable strings.
valuesimple-type-printable-equatableLike gen/simple-type-printable, but only generates objects that can be equal to other objects (e.g., not a NaN).
valueGenerates an integer (long or bigint) bounded exclusively by ±2^(6*size).
valueCreates a generator that depends on the size parameter. `sized-gen` is a function that takes an integer and returns ...
function([sized-gen])
Generates a positive or negative integer bounded by the generator's `size` parameter. Shrinks to zero.
valueGenerates a sorted set of elements from the given generator. If the generator cannot or is unlikely to produce enough...
function([gen] [gen opts])
Generates strings. May generate unprintable characters.
valueDeprecated - use string-alphanumeric instead. Generates alphanumeric strings.
valueGenerates alphanumeric strings.
valueGenerates ascii strings.
valueCreates a generator that generates values from `gen` that satisfy predicate `pred`. Care is needed to ensure there is ...
function([pred gen] [pred gen max-tries-or-opts])
Generates symbols without namespaces.
valueGenerates symbols with namespaces.
value
T
Creates a generator that returns a vector, whose elements are chosen from the generators in the same position. The ind...
function([& generators])
U
Generates a random type-4 UUID. Does not shrink.
value
V
Creates a generator of vectors whose elements are chosen from `generator`. The count of the vector will be bounded by ...
function([generator] [generator num-elements] [generator min-elements max-elements])
Generates a vector of elements from the given generator, with the guarantee that the elements will be distinct. If ...
function([gen] [gen opts])
Generates a vector of elements from the given generator, with the guarantee that (map key-fn the-vector) will be disti...
function([key-fn gen] [key-fn gen opts])