Copyright © 2010-2020 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
Version: May 19 2021 06:40:24
Authors: Manolis Papadakis.
Generator subsystem and generators for basic types.
You can use these functions to try out the random instance generation and shrinking subsystems.
CAUTION: These functions should never be used inside properties. They are meant for demonstration purposes only.alt_gens() = fun(() -> [imm_instance()])
combine_fun() = fun((instance()) -> imm_instance())
generator() = sized_generator() | typed_sized_generator() | nosize_generator() | typed_nosize_generator()
imm_instance() = proper_types:raw_type() | instance() | {'$used', imm_instance(), imm_instance()} | {'$to_part', imm_instance()}
A value produced by the random instance generator.
instance() = term()
nosize_generator() = fun(() -> imm_instance())
plain_reverse_gen() = fun((instance()) -> imm_instance())
reverse_gen() = plain_reverse_gen() | typed_reverse_gen()
seed() = {non_neg_integer(), non_neg_integer(), non_neg_integer()}
size() = non_neg_integer()
sized_generator() = fun((size()) -> imm_instance())
typed_nosize_generator() = {typed, fun((proper_types:type()) -> imm_instance())}
typed_reverse_gen() = {typed, fun((proper_types:type(), instance()) -> imm_instance())}
typed_sized_generator() = {typed, fun((proper_types:type(), size()) -> imm_instance())}
pick/1 | Equivalent to pick(Type, 10). |
pick/2 | Equivalent to pick(Type, Size, os:timestamp()). |
pick/3 | Generates a random instance of Type , of size Size with seed Seed . |
sample/1 | Equivalent to sample(Type, 10, 20). |
sample/3 | Generates and prints one random instance of Type for each size from
StartSize up to EndSize . |
sampleshrink/1 | Equivalent to sampleshrink(Type, 10). |
sampleshrink/2 | Generates a random instance of Type , of size Size , then shrinks it
as far as it goes. |
pick(Type::proper_types:raw_type()) -> {ok, instance()} | error
Equivalent to pick(Type, 10).
pick(Type::proper_types:raw_type(), Size::size()) -> {ok, instance()} | error
Equivalent to pick(Type, Size, os:timestamp()).
pick(Type::proper_types:raw_type(), Size::size(), Seed::seed()) -> {ok, instance()} | error
Generates a random instance of Type
, of size Size
with seed Seed
.
sample(Type::proper_types:raw_type()) -> ok
Equivalent to sample(Type, 10, 20).
sample(Type::proper_types:raw_type(), StartSize::size(), EndSize::size()) -> ok
Generates and prints one random instance of Type
for each size from
StartSize
up to EndSize
.
sampleshrink(Type::proper_types:raw_type()) -> ok
Equivalent to sampleshrink(Type, 10).
sampleshrink(Type::proper_types:raw_type(), Size::size()) -> ok
Generates a random instance of Type
, of size Size
, then shrinks it
as far as it goes. The value produced on each step of the shrinking process
is printed on the screen.
Generated by EDoc