schema.experimental.generators

deprecated in 1.1.0

(Very) experimental support for compiling schemas to test.check generators.
To use it, you must provide your own test.check dependency.

TODO: add cljs support.

+primitive-generators+

+simple-leaf-generators+

always

(always x)

CompositeGenerator

protocol

members

composite-generator

(composite-generator s params)

default-leaf-generators

(default-leaf-generators leaf-generators)

element-generator

(element-generator e params)

elements-generator

(elements-generator elts params)

enum-generators

(enum-generators s)

eq-generators

(eq-generators s)

fmap

(fmap f)
Helper wrapper that maps f over all values.

g-apply-by

(g-apply-by f args)

g-by

(g-by f & args)

generate

(generate & generator-args)
Inputs: [& generator-args]

Sample a single element of low to moderate size.

Generator

A test.check generator

generator

(generator schema)(generator schema leaf-generators)(generator schema leaf-generators wrappers)
Inputs: ([schema] [schema leaf-generators] [schema :- Schema leaf-generators :- LeafGenerators wrappers :- GeneratorWrappers])
Returns: Generator

Produce a test.check generator for schema.

 leaf-generators must return generators for all leaf schemas, and can also return
 generators for non-leaf schemas to override default generation logic.

 constraints is an optional mapping from schema to wrappers for the default generators,
 which can impose constraints, fix certain values, etc.

GeneratorWrappers

A mapping from schemas to wrappers that should be used around the default
generators.

LeafGenerators

A mapping from schemas to generating functions that should be used.

merged

(merged m)
Helper wrapper that merges some keys into a schema

sample

(sample k & generator-args)
Inputs: [k & generator-args]
Returns: [s/Any]

Sample k elements from generator.

Schema

A Schema for Schemas

such-that

(such-that f)
Helper wrapper that filters to values that match predicate.