Module proper_gen

Generator subsystem and generators for basic types.

Copyright © 2010-2016 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas

Version: Jun 20 2016 16:27:12

Authors: Manolis Papadakis.

Description

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.

Data Types

instance()

instance() = term()

A value produced by the random instance generator.

seed()

seed() = 
    {non_neg_integer(), non_neg_integer(), non_neg_integer()}

size()

size() = non_neg_integer()

Function Index

pick/1Equivalent to pick(Type, 10).
pick/2Equivalent to pick(Type, Size, os:timestamp()).
pick/3Generates a random instance of Type, of size Size with seed Seed.
sample/1Equivalent to sample(Type, 10, 20).
sample/3Generates and prints one random instance of Type for each size from StartSize up to EndSize.
sampleshrink/1Equivalent to sampleshrink(Type, 10).
sampleshrink/2Generates a random instance of Type, of size Size, then shrinks it as far as it goes.

Function Details

pick/1

pick(Type :: proper_types:raw_type()) -> {ok, instance()} | error

Equivalent to pick(Type, 10).

pick/2

pick(Type :: proper_types:raw_type(), Size :: size()) ->
        {ok, instance()} | error

Equivalent to pick(Type, Size, os:timestamp()).

pick/3

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/1

sample(Type :: proper_types:raw_type()) -> ok

Equivalent to sample(Type, 10, 20).

sample/3

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/1

sampleshrink(Type :: proper_types:raw_type()) -> ok

Equivalent to sampleshrink(Type, 10).

sampleshrink/2

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, Jun 20 2016, 16:27:12.