category

arbitrary

Adds predicates for generating random values for selected types to the library “type” object.

Author: Paulo Moura
Version: 1.13
Date: 2018/4/4
Compilation flags:
static

Public interface

arbitrary/1

Table of defined types for which an arbitrary value can be generated. A new type can be registered by defining a clause for this predicate and adding a clause for the arbitrary/2 multifile predicate.

Compilation flags:
static, multifile
Template:
arbitrary(Type)
Mode and number of proofs:
arbitrary(?callable) - zero_or_more

arbitrary/2

Generates an arbitrary term of the specified type. Fails if the given type is not supported. A new generator can be added by defining a clause for this predicate and registering it by adding a clause for the arbitrary/1 multifile predicate.

Compilation flags:
static, multifile
Template:
arbitrary(Type,Term)
Mode and number of proofs:
arbitrary(@callable,-term) - zero_or_one

shrink/3

Shrinks a value to a smaller value. Fails if the given type is not supported or if shrinking the value is not possible. Support for a new type can be added by defining a clause for this predicate.

Compilation flags:
static, multifile
Template:
shrink(Type,Large,Small)
Mode and number of proofs:
shrink(@callable,@term,-term) - zero_or_one

Protected interface

(see related entities)

Private predicates

(see related entities)

Operators

(none)

Remarks

  • Atom character sets: When generating atoms or character codes, or terms that contain them, it is possible to choose a character set (ascii_printable, ascii_full, byte, unicode_bmp, or unicode_full) using the parameterizable types. Default is ascii_printable.

See also

type