kotest-assertions / io.kotest.properties

Package io.kotest.properties

Types

BigIntegerGen

class BigIntegerGen : Gen<BigInteger>

Gen

A Generator, or Gen is responsible for generating data to be used in property testing. Each generator will generate data for a specific type .

interface Gen<T>

PropertyContext

A PropertyContext is used when executing a propery test. It allows feedback and tracking of the state of the property test.

class PropertyContext

PropertyFailureInput

data class PropertyFailureInput<T>

PropertyTesting

object PropertyTesting

RegexpGen

class RegexpGen : Gen<String>

Tuple4

data class Tuple4<out A, out B, out C, out D>

Tuple5

data class Tuple5<out A, out B, out C, out D, out E>

Tuple6

data class Tuple6<out A, out B, out C, out D, out E, out F>

TypeReference

abstract class TypeReference<T> : Comparable<TypeReference<T>>

UUIDVersion

enum class UUIDVersion

Extensions for External Classes

kotlin.random.Random

kotlin.reflect.KFunction1

kotlin.reflect.KFunction2

Functions

_assertAll

fun <A> _assertAll(iterations: Int, values: Sequence<A>, shrinkera: Shrinker<A>?, fn: PropertyContext.(a: A) -> Unit): Unit
fun <A, B> _assertAll(iterations: Int, values: Sequence<Pair<A, B>>, shrinkera: Shrinker<A>?, shrinkerb: Shrinker<B>?, fn: PropertyContext.(a: A, b: B) -> Unit): Unit

assertAll

fun <A> assertAll(fn: PropertyContext.(a: A) -> Unit): Unit
fun <A> assertAll(iterations: Int, fn: PropertyContext.(a: A) -> Unit): Unit
fun <A> assertAll(gena: Gen<A>, fn: PropertyContext.(a: A) -> Unit): Unit
fun <A> Gen<A>.assertAll(iterations: Int = 1000, fn: PropertyContext.(a: A) -> Unit): Unit
fun <A> Gen<A>.assertAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A) -> Unit): Unit
fun <A> Gen<A>.assertAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A) -> Unit): Unit
fun <A> Gen<A>.assertAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A) -> Unit): Unit
fun <A> Gen<A>.assertAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A) -> Unit): Unit
fun <A> Gen<A>.assertAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A, a5: A) -> Unit): Unit
fun <A> assertAll(iterations: Int, gena: Gen<A>, fn: PropertyContext.(a: A) -> Unit): Unit
fun <A, B> assertAll(fn: PropertyContext.(a: A, b: B) -> Unit): Unit
fun <A, B> assertAll(iterations: Int, fn: PropertyContext.(a: A, b: B) -> Unit): Unit
fun <A, B> assertAll(gena: Gen<A>, genb: Gen<B>, fn: PropertyContext.(a: A, b: B) -> Unit): Unit
fun <A, B> assertAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, fn: PropertyContext.(a: A, b: B) -> Unit): Unit
fun <A, B, C> assertAll(fn: PropertyContext.(a: A, b: B, c: C) -> Unit): Unit
fun <A, B, C> assertAll(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C) -> Unit): Unit
fun <A, B, C> assertAll(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, fn: PropertyContext.(a: A, b: B, c: C) -> Unit): Unit
fun <A, B, C> assertAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, fn: PropertyContext.(a: A, b: B, c: C) -> Unit): Unit
fun <A, B, C, D> assertAll(fn: PropertyContext.(a: A, b: B, c: C, D) -> Unit): Unit
fun <A, B, C, D> assertAll(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, D) -> Unit): Unit
fun <A, B, C, D> assertAll(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Unit): Unit
fun <A, B, C, D> assertAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Unit): Unit
fun <A, B, C, D, E> assertAll(fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Unit): Unit
fun <A, B, C, D, E> assertAll(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Unit): Unit
fun <A, B, C, D, E> assertAll(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Unit): Unit
fun <A, B, C, D, E> assertAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Unit): Unit
fun <A, B, C, D, E, F> assertAll(fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Unit): Unit
fun <A, B, C, D, E, F> assertAll(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Unit): Unit
fun <A, B, C, D, E, F> assertAll(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Unit): Unit
fun <A, B, C, D, E, F> assertAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Unit): Unit

assertNone

fun <A> assertNone(fn: PropertyContext.(a: A) -> Unit): Unit
fun <A> assertNone(iterations: Int, fn: PropertyContext.(a: A) -> Unit): Unit
fun <A> assertNone(gena: Gen<A>, fn: PropertyContext.(a: A) -> Unit): Unit
fun <A> Gen<A>.assertNone(iterations: Int = 1000, fn: PropertyContext.(a0: A) -> Unit): Unit
fun <A> Gen<A>.assertNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A) -> Unit): Unit
fun <A> Gen<A>.assertNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A) -> Unit): Unit
fun <A> Gen<A>.assertNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A) -> Unit): Unit
fun <A> Gen<A>.assertNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A) -> Unit): Unit
fun <A> Gen<A>.assertNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A, a5: A) -> Unit): Unit
fun <A> assertNone(iterations: Int, gena: Gen<A>, fn: PropertyContext.(a: A) -> Unit): Unit
fun <A, B> assertNone(fn: PropertyContext.(a: A, b: B) -> Unit): Unit
fun <A, B> assertNone(iterations: Int, fn: PropertyContext.(a: A, b: B) -> Unit): Unit
fun <A, B> assertNone(gena: Gen<A>, genb: Gen<B>, fn: PropertyContext.(a: A, b: B) -> Unit): Unit
fun <A, B> assertNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, fn: PropertyContext.(a: A, b: B) -> Unit): Unit
fun <A, B, C> assertNone(fn: PropertyContext.(a: A, b: B, c: C) -> Unit): Unit
fun <A, B, C> assertNone(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C) -> Unit): Unit
fun <A, B, C> assertNone(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, fn: PropertyContext.(a: A, b: B, c: C) -> Unit): Unit
fun <A, B, C> assertNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, fn: PropertyContext.(a: A, b: B, c: C) -> Unit): Unit
fun <A, B, C, D> assertNone(fn: PropertyContext.(a: A, b: B, c: C, D) -> Unit): Unit
fun <A, B, C, D> assertNone(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, D) -> Unit): Unit
fun <A, B, C, D> assertNone(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Unit): Unit
fun <A, B, C, D> assertNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Unit): Unit
fun <A, B, C, D, E> assertNone(fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Unit): Unit
fun <A, B, C, D, E> assertNone(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Unit): Unit
fun <A, B, C, D, E> assertNone(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Unit): Unit
fun <A, B, C, D, E> assertNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Unit): Unit
fun <A, B, C, D, E, F> assertNone(fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Unit): Unit
fun <A, B, C, D, E, F> assertNone(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Unit): Unit
fun <A, B, C, D, E, F> assertNone(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Unit): Unit
fun <A, B, C, D, E, F> assertNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Unit): Unit

filterIsInstance

Create a new Gen by keeping only instances of U generated by this gen. This is useful if you have a type hierarchy and only want to retain a particular subtype.

fun <T, U : T> Gen<T>.filterIsInstance(): Gen<U>

forAll

fun <A> forAll(fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A> forAll(iterations: Int, fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A> forAll(gena: Gen<A>, fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A> Gen<A>.forAll(iterations: Int = 1000, fn: PropertyContext.(a0: A) -> Boolean): Unit
fun <A> Gen<A>.forAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A) -> Boolean): Unit
fun <A> Gen<A>.forAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A) -> Boolean): Unit
fun <A> Gen<A>.forAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A) -> Boolean): Unit
fun <A> Gen<A>.forAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A) -> Boolean): Unit
fun <A> Gen<A>.forAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A, a5: A) -> Boolean): Unit
fun <A> forAll(iterations: Int, gena: Gen<A>, fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A, B> forAll(fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B> forAll(iterations: Int, fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B> forAll(gena: Gen<A>, genb: Gen<B>, fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B> forAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B, C> forAll(fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C> forAll(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C> forAll(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C> forAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C, D> forAll(fn: PropertyContext.(a: A, b: B, c: C, D) -> Boolean): Unit
fun <A, B, C, D> forAll(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, D) -> Boolean): Unit
fun <A, B, C, D> forAll(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Boolean): Unit
fun <A, B, C, D> forAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Boolean): Unit
fun <A, B, C, D, E> forAll(fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E> forAll(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E> forAll(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E> forAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E, F> forAll(fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit
fun <A, B, C, D, E, F> forAll(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit
fun <A, B, C, D, E, F> forAll(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit
fun <A, B, C, D, E, F> forAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit

forClassName

fun forClassName(className: String): Gen<*>

forNone

fun <A> forNone(fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A> forNone(iterations: Int, fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A> forNone(gena: Gen<A>, fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A> Gen<A>.forNone(iterations: Int = 1000, fn: PropertyContext.(a0: A) -> Boolean): Unit
fun <A> Gen<A>.forNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A) -> Boolean): Unit
fun <A> Gen<A>.forNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A) -> Boolean): Unit
fun <A> Gen<A>.forNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A) -> Boolean): Unit
fun <A> Gen<A>.forNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A) -> Boolean): Unit
fun <A> Gen<A>.forNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A, a5: A) -> Boolean): Unit
fun <A> forNone(iterations: Int, gena: Gen<A>, fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A, B> forNone(fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B> forNone(iterations: Int, fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B> forNone(gena: Gen<A>, genb: Gen<B>, fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B> forNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B, C> forNone(fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C> forNone(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C> forNone(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C> forNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C, D> forNone(fn: PropertyContext.(a: A, b: B, c: C, D) -> Boolean): Unit
fun <A, B, C, D> forNone(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, D) -> Boolean): Unit
fun <A, B, C, D> forNone(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Boolean): Unit
fun <A, B, C, D> forNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Boolean): Unit
fun <A, B, C, D, E> forNone(fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E> forNone(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E> forNone(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E> forNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E, F> forNone(fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit
fun <A, B, C, D, E, F> forNone(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit
fun <A, B, C, D, E, F> forNone(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit
fun <A, B, C, D, E, F> forNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit

generateInfiniteSequence

Create a infinite sequence of the given generator

fun <T> generateInfiniteSequence(generator: () -> T): Sequence<T>

next

Draws a random value from this generator

fun <T> Gen<T>.next(predicate: (T) -> Boolean = { true }, seed: Long?): Tfun <T> Gen<T>.next(predicate: (T) -> Boolean = { true }): T

outputClassifications

fun outputClassifications(context: PropertyContext): Unit

outputValues

fun outputValues(context: PropertyContext): Unit

propertyTestFailureMessage

fun propertyTestFailureMessage(attempt: Int, inputs: List<PropertyFailureInput<out Any?>>, cause: AssertionError): String

take

Draws amount values from this generator

fun <T> Gen<T>.take(amount: Int, seed: Long? = null): List<T>

testAndShrink

fun <A> testAndShrink(a: A, shrinkera: Shrinker<A>?, context: PropertyContext, fn: PropertyContext.(a: A) -> Unit): Unit
fun <A, B> testAndShrink(a: A, b: B, shrinkera: Shrinker<A>?, shrinkerb: Shrinker<B>?, context: PropertyContext, fn: PropertyContext.(a: A, b: B) -> Unit): Unit
fun <A, B, C> testAndShrink(a: A, b: B, c: C, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, context: PropertyContext, fn: PropertyContext.(a: A, b: B, c: C) -> Unit): Unit
fun <A, B, C, D> testAndShrink(a: A, b: B, c: C, d: D, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, context: PropertyContext, fn: PropertyContext.(a: A, b: B, c: C, D) -> Unit): Unit
fun <A, B, C, D, E> testAndShrink(a: A, b: B, c: C, d: D, e: E, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, context: PropertyContext, fn: PropertyContext.(a: A, b: B, c: C, D, E) -> Unit): Unit

uniqueRandoms

Creates a sequence of unique values from the contents of random, using seed to seed the random function.

fun <T> Gen<T>.uniqueRandoms(seed: Long? = null): Sequence<T>

verifyAll

fun <A> verifyAll(fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A> verifyAll(iterations: Int, fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A> verifyAll(gena: Gen<A>, fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A> Gen<A>.verifyAll(iterations: Int = 1000, fn: PropertyContext.(a0: A) -> Boolean): Unit
fun <A> Gen<A>.verifyAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A) -> Boolean): Unit
fun <A> Gen<A>.verifyAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A) -> Boolean): Unit
fun <A> Gen<A>.verifyAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A) -> Boolean): Unit
fun <A> Gen<A>.verifyAll(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A, a5: A) -> Boolean): Unit
fun <A> verifyAll(iterations: Int, gena: Gen<A>, fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A, B> verifyAll(fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B> verifyAll(iterations: Int, fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B> verifyAll(gena: Gen<A>, genb: Gen<B>, fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B> verifyAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B, C> verifyAll(fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C> verifyAll(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C> verifyAll(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C> verifyAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C, D> verifyAll(fn: PropertyContext.(a: A, b: B, c: C, D) -> Boolean): Unit
fun <A, B, C, D> verifyAll(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, D) -> Boolean): Unit
fun <A, B, C, D> verifyAll(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Boolean): Unit
fun <A, B, C, D> verifyAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Boolean): Unit
fun <A, B, C, D, E> verifyAll(fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E> verifyAll(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E> verifyAll(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E> verifyAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E, F> verifyAll(fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit
fun <A, B, C, D, E, F> verifyAll(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit
fun <A, B, C, D, E, F> verifyAll(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit
fun <A, B, C, D, E, F> verifyAll(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit

verifyNone

fun <A> verifyNone(fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A> verifyNone(iterations: Int, fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A> verifyNone(gena: Gen<A>, fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A> Gen<A>.verifyNone(iterations: Int = 1000, fn: PropertyContext.(a0: A) -> Boolean): Unit
fun <A> Gen<A>.verifyNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A) -> Boolean): Unit
fun <A> Gen<A>.verifyNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A) -> Boolean): Unit
fun <A> Gen<A>.verifyNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A) -> Boolean): Unit
fun <A> Gen<A>.verifyNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A) -> Boolean): Unit
fun <A> Gen<A>.verifyNone(iterations: Int = 1000, fn: PropertyContext.(a0: A, a1: A, a2: A, a3: A, a4: A, a5: A) -> Boolean): Unit
fun <A> verifyNone(iterations: Int, gena: Gen<A>, fn: PropertyContext.(a: A) -> Boolean): Unit
fun <A, B> verifyNone(fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B> verifyNone(iterations: Int, fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B> verifyNone(gena: Gen<A>, genb: Gen<B>, fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B> verifyNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, fn: PropertyContext.(a: A, b: B) -> Boolean): Unit
fun <A, B, C> verifyNone(fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C> verifyNone(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C> verifyNone(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C> verifyNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, fn: PropertyContext.(a: A, b: B, c: C) -> Boolean): Unit
fun <A, B, C, D> verifyNone(fn: PropertyContext.(a: A, b: B, c: C, D) -> Boolean): Unit
fun <A, B, C, D> verifyNone(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, D) -> Boolean): Unit
fun <A, B, C, D> verifyNone(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Boolean): Unit
fun <A, B, C, D> verifyNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, fn: PropertyContext.(a: A, b: B, c: C, d: D) -> Boolean): Unit
fun <A, B, C, D, E> verifyNone(fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E> verifyNone(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E> verifyNone(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E> verifyNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E) -> Boolean): Unit
fun <A, B, C, D, E, F> verifyNone(fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit
fun <A, B, C, D, E, F> verifyNone(iterations: Int, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit
fun <A, B, C, D, E, F> verifyNone(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit
fun <A, B, C, D, E, F> verifyNone(iterations: Int, gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, fn: PropertyContext.(a: A, b: B, c: C, d: D, e: E, f: F) -> Boolean): Unit

Companion Object Functions

bigInteger

fun Gen.Companion.bigInteger(maxNumBits: Int = 32): Gen<BigInteger>

bind

fun <A, T> Gen.Companion.bind(gena: Gen<A>, createFn: (A) -> T): Gen<T>
fun <A, B, T> Gen.Companion.bind(gena: Gen<A>, genb: Gen<B>, createFn: (A, B) -> T): Gen<T>
fun <A, B, C, T> Gen.Companion.bind(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, createFn: (A, B, C) -> T): Gen<T>
fun <A, B, C, D, T> Gen.Companion.bind(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, createFn: (A, B, C, D) -> T): Gen<T>
fun <A, B, C, D, E, T> Gen.Companion.bind(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, createFn: (A, B, C, D, E) -> T): Gen<T>
fun <A, B, C, D, E, F, T> Gen.Companion.bind(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, createFn: (A, B, C, D, E, F) -> T): Gen<T>
fun <A, B, C, D, E, F, G, T> Gen.Companion.bind(gena: Gen<A>, genb: Gen<B>, genc: Gen<C>, gend: Gen<D>, gene: Gen<E>, genf: Gen<F>, geng: Gen<G>, createFn: (A, B, C, D, E, F, G) -> T): Gen<T>

bool

Returns both boolean values

fun Gen.Companion.bool(): Gen<Boolean>

byte

Returns a stream of values where each value is a randomly chosen Byte. The values always returned include the following edge cases: [Byte.MIN_VALUE, Byte.MAX_VALUE, 0]

fun Gen.Companion.byte(): Gen<Byte>

char

Returns a stream of randomly-chosen Chars. Custom characters can be generated by providing CharRanges. Distribution will be even across the ranges of Chars. For example: Gen.char('A'..'C', 'D'..'E') Ths will choose A, B, C, D, and E each 20% of the time.

fun Gen.Companion.char(range: CharRange, vararg ranges: CharRange): Gen<Char>

Returns a stream of randomly-chosen Chars. Custom characters can be generated by providing a list of CharRanges. Distribution will be even across the ranges of Chars. For example: Gen.char(listOf('A'..'C', 'D'..'E') Ths will choose A, B, C, D, and E each 20% of the time.

fun Gen.Companion.char(ranges: List<CharRange> = CharSets.BASIC_LATIN): Gen<Char>

choose

Returns a stream of values, where each value is a random Int between the given min and max.

fun Gen.Companion.choose(min: Int, max: Int): Gen<Int>

Returns a stream of values, where each value is a Long between the given min and max.

fun Gen.Companion.choose(min: Long, max: Long): Gen<Long>

Returns a stream of values based on weights:

fun <T : Any> Gen.Companion.choose(a: Pair<Int, T>, b: Pair<Int, T>, vararg cs: Pair<Int, T>): Gen<T>

constant

Returns a [Gen] which always returns the same value.

fun <T> Gen.Companion.constant(value: T): Gen<T>

create

Returns a stream of values, where each value is generated from the given function

fun <T> Gen.Companion.create(fn: () -> T): Gen<T>

default

fun <T> Gen.Companion.default(): Gen<T>

double

Returns a stream of values where each value is a randomly chosen Double.

fun Gen.Companion.double(): Gen<Double>

duration

Generates a stream of random Durations

fun Gen.Companion.duration(maxDuration: Duration = Duration.ofDays(10)): Gen<Duration>

enum

fun <T : Enum<T>> Gen.Companion.enum(): Gen<T>

factors

fun Gen.Companion.factors(k: Int): Gen<Int>

file

Returns a stream of values where each value is a randomly chosen created File object. The file objects do not necessarily exist on disk.

fun Gen.Companion.file(): Gen<File>

Returns a stream of values where each value is a randomly chosen File object from given directory. If the Directory does not exist, an empty sequence will be returned instead. If recursive is true(default value is false) it gives files from inner directories as well recursively.

fun Gen.Companion.file(directoryName: String, recursive: Boolean = false): Gen<File>

float

Returns a stream of values where each value is a randomly chosen Float.

fun Gen.Companion.float(): Gen<Float>

forClassName

fun Gen.Companion.forClassName(className: String): Gen<*>

from

Adapts a list into a generator, where random values will be picked. May not choose every item in the list.

fun <T> Gen.Companion.from(values: List<T>): Gen<T>fun <T> Gen.Companion.from(values: Array<T>): Gen<T>

int

Returns a stream of values where each value is a randomly chosen Int. The values always returned include the following edge cases: [Int.MIN_VALUE, Int.MAX_VALUE, 0, 1, -1]

fun Gen.Companion.int(): Gen<Int>

list

Returns a stream of values, where each value is a list of values generated by the underlying generator.

fun <T> Gen.Companion.list(gen: Gen<T>, maxSize: Int = 100): Gen<List<T>>

localDate

Generates a stream of random LocalDates

fun Gen.Companion.localDate(minYear: Int = 1970, maxYear: Int = 2030): Gen<LocalDate>

localDateTime

Generates a stream of random LocalDateTimes

fun Gen.Companion.localDateTime(minYear: Int = 1970, maxYear: Int = 2030): Gen<LocalDateTime>

localTime

Generates a stream of random LocalTimes

fun Gen.Companion.localTime(): Gen<LocalTime>

long

Returns a stream of values where each value is a randomly chosen long. The values returned always include the following edge cases: [Long.MIN_VALUE, Long.MAX_VALUE, 0, 1, -1]

fun Gen.Companion.long(): Gen<Long>

map

Returns a stream of values, where each value is a Map, which contains keys and values generated from the underlying generators.

fun <K, V> Gen.Companion.map(genK: Gen<K>, genV: Gen<V>, maxSize: Int = 100): Gen<Map<K, V>>fun <K, V> Gen.Companion.map(gen: Gen<Pair<K, V>>, maxSize: Int = 100): Gen<Map<K, V>>

multiples

fun Gen.Companion.multiples(k: Int, max: Int): Gen<Int>

nats

Returns a stream of values where each value is a randomly chosen natural number. The values returned always include the following edge cases: Int.MAX_VALUE

fun Gen.Companion.nats(): Gen<Int>

negativeDoubles

fun Gen.Companion.negativeDoubles(): Gen<Double>

negativeIntegers

Returns a stream of values where each value is a randomly chosen negative value. The values returned always include the following edge cases: Int.MIN_VALUE

fun Gen.Companion.negativeIntegers(): Gen<Int>

numericDoubles

Returns a Gen which is the same as Gen.double but does not include +INFINITY, -INFINITY or NaN.

fun Gen.Companion.numericDoubles(from: Double = Double.MIN_VALUE, to: Double = Double.MAX_VALUE): Gen<Double>

numericFloats

Returns a Gen which is the same as Gen.float but does not include +INFINITY, -INFINITY or NaN.

fun Gen.Companion.numericFloats(from: Float = Float.MIN_VALUE, to: Float = Float.MAX_VALUE): Gen<Float>

oneOf

fun <A> Gen.Companion.oneOf(vararg gens: Gen<out A>): Gen<A>

pair

Returns a stream of values, where each value is a pair generated by the underlying generators.

fun <K, V> Gen.Companion.pair(genK: Gen<K>, genV: Gen<V>): Gen<Pair<K, V>>

period

Generates a stream of random Periods

fun Gen.Companion.period(maxYear: Int = 10): Gen<Period>

positiveDoubles

fun Gen.Companion.positiveDoubles(): Gen<Double>

positiveIntegers

Returns a stream of values where each value is a randomly chosen positive value. The values returned always include the following edge cases: Int.MAX_VALUE

fun Gen.Companion.positiveIntegers(): Gen<Int>

regex

fun Gen.Companion.regex(regex: String): RegexpGen
fun Gen.Companion.regex(regex: Regex): RegexpGen

samples

Returns a Gen which returns the sample values in the same order as they are passed in, once all sample values are used it repeats elements from start.

fun <T> Gen.Companion.samples(vararg sampleValues: T): Gen<T>

set

Returns a stream of values, where each value is a set of values generated by the given generator.

fun <T> Gen.Companion.set(gen: Gen<T>, maxSize: Int = 100): Gen<Set<T>>

short

Returns a stream of values where each value is a randomly chosen Short. The values always returned include the following edge cases: [Short.MIN_VALUE, Short.MAX_VALUE, 0]

fun Gen.Companion.short(): Gen<Short>

string

Returns a stream of values where each value is a random printed string.

fun Gen.Companion.string(minSize: Int = 0, maxSize: Int = 100): Gen<String>

triple

Returns a [Gen] where each value is a [Triple] generated by a value from each of three supplied generators.

fun <A, B, C> Gen.Companion.triple(genA: Gen<A>, genB: Gen<B>, genC: Gen<C>): Gen<Triple<A, B, C>>

ubyte

Returns a stream of values where each value is a randomly chosen UByte. The values always returned include the following edge cases: [UByte.MIN_VALUE, UByte.MAX_VALUE]

fun Gen.Companion.ubyte(): Gen<Byte>

uint

Returns a stream of values where each value is a randomly chosen UInt. The values always returned include the following edge cases: [UInt.MIN_VALUE, UInt.MAX_VALUE]

fun Gen.Companion.uint(): Gen<UInt>

ulong

Returns a stream of values where each value is a randomly chosen ULong. The values returned always include the following edge cases: [ULong.MIN_VALUE, ULong.MAX_VALUE]

fun Gen.Companion.ulong(): Gen<ULong>

ushort

Returns a stream of values where each value is a randomly chosen UShort. The values always returned include the following edge cases: [UShort.MIN_VALUE, UShort.MAX_VALUE]

fun Gen.Companion.ushort(): Gen<UShort>

uuid

fun Gen.Companion.uuid(uuidVersion: UUIDVersion = UUIDVersion.V4, allowNilValue: Boolean = true): Gen<UUID>