Hegel.Generator (hegel_elixir v0.1.1)

View Source

A value generator driven by a Hegel test case.

A generator receives the current Hegel.TestCase and asks libhegel for each choice. The engine records those choices for replay and shrinking.

Build common generators with Hegel.Generators. Use new/1 for a custom generator.

Summary

Types

A generator of values of type value.

Functions

Builds a generator from a function which receives the active test case.

Types

t(value)

@opaque t(value)

A generator of values of type value.

Functions

new(draw)

@spec new((Hegel.TestCase.t() -> value)) :: t(value) when value: term()

Builds a generator from a function which receives the active test case.

Prefer Hegel.Generators.composite/1 when the function draws from other generators, since it adds a structural span for better shrinking.