AnyUtils extension

Useful utilities for creating Geneators that behave just like you want to.

on

Methods

always<T>(T value) Generator<T>

Available on Any, provided by the AnyUtils extension

Returns always the same value.
choose<T>(List<T> values) Generator<T>

Available on Any, provided by the AnyUtils extension

Chooses between the given values. Values further at the front of the list are considered less complex.
either<T>(Generator<T> first, Generator<T> second, [Generator<T>? third, Generator<T>? fourth, Generator<T>? fifth, Generator<T>? sixth, Generator<T>? seventh, Generator<T>? nineth, Generator<T>? tenth]) Generator<T>

Available on Any, provided by the AnyUtils extension

Uses either one of the provided generators to generate a value.
oneOf<T>(List<Generator<T>> generators) Generator<T>

Available on Any, provided by the AnyUtils extension

Uses one of the supplied generators to generate a value.
simple<T>({required T generate(Random random, int size), required Iterable<T> shrink(T input)}) Generator<T>

Available on Any, provided by the AnyUtils extension

Creates a new, simple Generator that produces values and knows how to simplify them.