AnyUtils extension

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

on

Methods

always<T>(T value) Generator<T>
Returns always the same value.
choose<T>(List<T> values) Generator<T>
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>
Uses either one of the provided generators to generate a value.
oneOf<T>(List<Generator<T>> generators) Generator<T>
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>
Creates a new, simple Generator that produces values and knows how to simplify them.