kotest-property / io.kotest.property

Package io.kotest.property

Types

Gen

A Gen is responsible for providing values to be used in property testing. You can think of it as like an input stream for values. Each arg will provide data for a specific type .

interface Gen<out A>

PropertyContext

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

class PropertyContext

PropertyTesting

Global object for containing settings for property testing.

object PropertyTesting

PropTestConfig

data class PropTestConfig

RandomSource

data class RandomSource

RTree

data class RTree<out A>

Sample

Contains a single generated value from a Gen and an RTree of lazily evaluated shrinks.

data class Sample<out A>

Shrinker

Given a value, T, this function returns reduced values to be used as candidates for shrinking.

interface Shrinker<A>

ShrinkingMode

sealed class ShrinkingMode

Extensions for External Classes

kotlin.Long

kotlin.random.Random

Functions

checkAll

suspend fun <A> checkAll(genA: Gen<A>, property: suspend PropertyContext.(A) -> Unit): PropertyContext
suspend fun <A> checkAll(iterations: Int, genA: Gen<A>, property: suspend PropertyContext.(A) -> Unit): PropertyContext
suspend fun <A> checkAll(config: PropTestConfig, genA: Gen<A>, property: suspend PropertyContext.(A) -> Unit): PropertyContext
suspend fun <A> checkAll(iterations: Int, config: PropTestConfig, genA: Gen<A>, property: suspend PropertyContext.(A) -> Unit): PropertyContext
suspend fun <A> checkAll(property: suspend PropertyContext.(A) -> Unit): PropertyContext
suspend fun <A> checkAll(iterations: Int, property: suspend PropertyContext.(A) -> Unit): PropertyContext
suspend fun <A> checkAll(config: PropTestConfig, property: suspend PropertyContext.(A) -> Unit): PropertyContext
suspend fun <A> checkAll(iterations: Int, config: PropTestConfig, property: suspend PropertyContext.(A) -> Unit): PropertyContext
suspend fun <A, B> checkAll(genA: Gen<A>, genB: Gen<B>, property: suspend PropertyContext.(A, B) -> Unit): PropertyContext
suspend fun <A, B> checkAll(config: PropTestConfig, genA: Gen<A>, genB: Gen<B>, property: suspend PropertyContext.(A, B) -> Unit): PropertyContext
suspend fun <A, B> checkAll(iterations: Int, genA: Gen<A>, genB: Gen<B>, property: suspend PropertyContext.(A, B) -> Unit): PropertyContext
suspend fun <A, B> checkAll(iterations: Int, config: PropTestConfig, genA: Gen<A>, genB: Gen<B>, property: suspend PropertyContext.(A, B) -> Unit): PropertyContext
suspend fun <A, B> checkAll(property: suspend PropertyContext.(A, B) -> Unit): PropertyContext
suspend fun <A, B> checkAll(config: PropTestConfig, property: suspend PropertyContext.(A, B) -> Unit): PropertyContext
suspend fun <A, B> checkAll(iterations: Int, property: suspend PropertyContext.(A, B) -> Unit): PropertyContext
suspend fun <A, B> checkAll(iterations: Int, config: PropTestConfig, property: suspend PropertyContext.(A, B) -> Unit): PropertyContext

forAll

suspend fun <A> forAll(genA: Gen<A>, property: PropertyContext.(A) -> Boolean): PropertyContext
suspend fun <A> forAll(iterations: Int, genA: Gen<A>, property: PropertyContext.(A) -> Boolean): PropertyContext
suspend fun <A> forAll(config: PropTestConfig, genA: Gen<A>, property: PropertyContext.(A) -> Boolean): PropertyContext
suspend fun <A> forAll(iterations: Int, config: PropTestConfig, genA: Gen<A>, property: PropertyContext.(A) -> Boolean): PropertyContext
suspend fun <A> forAll(property: suspend PropertyContext.(A) -> Boolean): PropertyContext
suspend fun <A> forAll(iterations: Int, property: suspend PropertyContext.(A) -> Boolean): PropertyContext
suspend fun <A> forAll(config: PropTestConfig, property: suspend PropertyContext.(A) -> Boolean): PropertyContext
suspend fun <A> forAll(iterations: Int, config: PropTestConfig, property: suspend PropertyContext.(A) -> Boolean): PropertyContext
suspend fun <A, B> forAll(genA: Gen<A>, genB: Gen<B>, property: suspend PropertyContext.(A, B) -> Boolean): PropertyContext
suspend fun <A, B> forAll(config: PropTestConfig = PropTestConfig(), genA: Gen<A>, genB: Gen<B>, property: suspend PropertyContext.(A, B) -> Boolean): PropertyContext
suspend fun <A, B> forAll(iterations: Int, genA: Gen<A>, genB: Gen<B>, property: suspend PropertyContext.(A, B) -> Boolean): PropertyContext
suspend fun <A, B> forAll(iterations: Int, config: PropTestConfig, genA: Gen<A>, genB: Gen<B>, property: suspend PropertyContext.(A, B) -> Boolean): PropertyContext
suspend fun <A, B> forAll(property: PropertyContext.(A, B) -> Boolean): PropertyContext
suspend fun <A, B> forAll(config: PropTestConfig = PropTestConfig(), property: PropertyContext.(A, B) -> Boolean): PropertyContext
suspend fun <A, B> forAll(iterations: Int, property: PropertyContext.(A, B) -> Boolean): PropertyContext
suspend fun <A, B> forAll(iterations: Int, config: PropTestConfig, property: PropertyContext.(A, B) -> Boolean): PropertyContext

map

fun <A, B> RTree<A>.map(f: (A) -> B): RTree<B>

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>

rtree

Generates an RTree of all shrinks from an initial value.

fun <A> Shrinker<A>.rtree(a: A): RTree<A>

sampleOf

fun <A> sampleOf(a: A, shrinker: Shrinker<A>): Sample<A>