interface Exhaustive<A> : Gen<A>
An exhaustive is a type of Gen which generates an exhaustive set of values from a defined range.
An example of a exhaustive is the sequence of integers from 0 to 100. Another example is all strings of two characters.
A progression is useful when you want to generate an exhaustive set of values from a given sample space, rather than random values from that space. For example, if you were testing a function that used an enum, you might prefer to guarantee that every enum value is used, rather than selecting randomly from amongst the enum values (with possible duplicates and gaps).
Exhaustives do not shrink their values. There is no need to find a smaller failing case, because the smaller values will themselves naturally be included in the tested values.
An exhaustive is less suitable when you have a large sample space you need to select values from.
values |
Returns the values of this Exhaustive. abstract val values: List<A> |
generate |
open fun generate(rs: RandomSource): Sequence<Sample<A>> |
minIterations |
The minimum iteration count required for this Gen to be invoked. Requesting a property test with fewer than this cound will result in an exception. open fun minIterations(): Int |
andNull |
fun <A> Exhaustive<A>.andNull(): Exhaustive<A?> |
merge |
Returns a new Gen which will merge the values from this gen and the values of the supplied gen together, taking one from each in turn. fun <A, B : A> Gen<A>.merge(other: Gen<B>): Gen<A> |
plus |
Returns an Exhaustive which is the concatentation of this exhaustive values plus the given exhaustive's values. operator fun <A> Exhaustive<A>.plus(other: Exhaustive<A>): Exhaustive<A> |
times |
Returns the cross product of two Exhaustives. operator fun <A, B : A> Exhaustive<A>.times(other: Exhaustive<B>): Exhaustive<Pair<A, B>> |
azstring |
fun Exhaustive.Companion.azstring(range: IntRange): Exhaustive<String> |
boolean |
Returns a Exhaustive of the two possible boolean values - true and false. fun Exhaustive.Companion.boolean(): Exhaustive<Boolean> |
bytes |
Returns a Exhaustive of bytes in the given range. fun Exhaustive.Companion.bytes(from: Byte = Byte.MIN_VALUE, to: Byte = Byte.MAX_VALUE): Exhaustive<Byte> |
collection |
fun <A> Exhaustive.Companion.collection(collection: Collection<A>): Exhaustive<A> |
constant |
Returns a Exhaustive whose value is a single constant. fun <A> Exhaustive.Companion.constant(a: A): Exhaustive<A> |
enum |
fun <T : Enum<T>> Exhaustive.Companion.enum(): Exhaustive<T> |
ints |
fun Exhaustive.Companion.ints(range: IntRange): Exhaustive<Int> |
lines |
fun Exhaustive.Companion.lines(file: File, charset: Charset = Charsets.UTF_8): Exhaustive<String> |
longs |
fun Exhaustive.Companion.longs(range: LongRange): Exhaustive<Long> |
nullable |
fun Exhaustive.Companion.nullable(): Exhaustive<Nothing?> |