AnyUtils extension
Useful utilities for creating Geneator
s 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< generators) → Generator<T> >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> -
Available on Any, provided by the AnyUtils extension
Creates a new, simple Generator that produces values and knows how to simplify them.