Module suppositions::generators [] [src]

This module describes how data gets generated from the underlying representation in the suppositions::data module.

Structs

BoolGenerator

See booleans.

CollectionGenerator

See collections

Const

See consts

FilterMapped

See Generator::filter_map

Filtered

See Generator::filter

FloatGenerator

See f32s or f64s

InfoPoolGenerator

See info_pools

IntGenerator

See u64s, i64s, etc.

LazyGenerator

See lazy

Mapped

See Generator::map

OneOfGenerator

See one_of

OneOfSnoc

Internal implementation for one_of. Forms a left-associated chain of generators.

OneOfTerm

Internal implementation for one_of. Forms the terminating case of the induction.

OptionalGenerator

See optional

ResultGenerator

See result

UniformFloatGenerator

See uniform_f32s or uniform_f64s

VecGenerator

See vecs

WeightedCoinGenerator

See weighted_coin

Traits

Generator

An object that can generate test data from an underlying data source.

GeneratorObject

Like Generator, but allows use as a trait object.

GeneratorSized

An extension trait that allows use of methods that assume Self has a known size, like #boxed.

OneOfItem

Internal implementation for one_of. Defines the operations supported by an choice in a one_of.

Functions

booleans

Generates boolean value with a 50% chance of being true.

collections

Generates a collection of the given type, populated with elements from the item generator.

consts

Always generates a clone of the given value.

f32s

Generates values that encompass all possible float values (positive and negative), including NaN, and sub-normal values.

f64s

Generates values that encompass all possible float values (positive and negative), including NaN, and sub-normal values.

find_minimal

Find the smalltest InfoPool such that the function check succeeds when applied to the generated arguments Mostly a convenience wrapper around the shrinking functions in the data module.

i16s

A generator that generates the full range of the specified type.

i32s

A generator that generates the full range of the specified type.

i64s

A generator that generates the full range of the specified type.

i8s

A generator that generates the full range of the specified type.

info_pools

Randomly generates an info-pool (mostly used for testing generators).

isizes

A generator that generates the full range of the specified type.

lazy

Returns a lazily evaluated generator. The thunk should be pure. Mostly used to allow recursive generators.

one_of

Allows the user to use one of a set of alternative generators. Often useful when you need to generate elements of an enum.

optional

Generates an Optional<_> value with a 50% chance of Some(_) from the inner generator, otherwise None.

result

Generates either an okay value from ok; or an error from err, with 50% chance of each.

u16s

A generator that generates integers of the specified type.

u32s

A generator that generates integers of the specified type.

u64s

A generator that generates integers of the specified type.

u8s

A generator that generates integers of the specified type.

uniform_f32s

Generates values that are uniformly distributed, such that the output value x satisifes 0.0 <= x < 1.0

uniform_f64s

Generates values that are uniformly distributed, such that the output value x satisifes 0.0 <= x < 1.0

usizes

A generator that generates integers of the specified type.

vecs

Generates vectors with items given by inner.

weighted_coin

Generates a boolean with the specified probability (0.0 <= p <= 1.0) of being true.

Type Definitions

Maybe

A convenience alias for generators that use the pool.