TypeCheck v0.1.2 TypeCheck.Type.StreamData View Source

Transforms types to generators.

This module is only included when the optional dependency :stream_data is added to your project's dependencies.

Link to this section Summary

Functions

When given a type, it is transformed to a StreamData generator that can be used in a property test.

Link to this section Functions

Link to this function

arbitrary_primitive_type_gen()

View Source

When given a type, it is transformed to a StreamData generator that can be used in a property test.

iex> import TypeCheck.Type.StreamData
iex> generator = TypeCheck.Type.build({:ok | :error, integer()}) |> to_gen()
iex> StreamData.seeded(generator, 42) |> Enum.take(10)
[
{:ok, -1},
{:ok, 2},
{:ok, -2},
{:ok, -4},
{:ok, 1},
{:ok, 1},
{:ok, 2},
{:ok, 4},
{:ok, -7},
{:ok, 5}
]