Package-level declarations

Types

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.8.0")
class ArbitraryProperty<T> : ReadOnlyProperty<Nothing?, T>
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.8.0")
class CombinatorScope
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.8.0")
sealed class Combined<R>
Link copied to clipboard
data class IntRangeArbitrary(min: Int, max: Int, minSize: Int, maxSize: Int) : ArbitraryDecorator<IntRange> , SizableArbitrary<IntRange>
Link copied to clipboard
typealias JqwikCharRange = CharRange
Link copied to clipboard
typealias JqwikIntRange = IntRange
Link copied to clipboard
typealias JqwikLongRange = LongRange
Link copied to clipboard
typealias JqwikShortRange = ShortRange
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
class SequenceArbitrary<T>(elementArbitrary: Arbitrary<T>) : ArbitraryDecorator<Sequence<T>> , SizableArbitrary<Sequence<T>>

Fluent interface to add functionality to arbitraries that generate instances of type Sequence

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.8.4")
class SubtypeScope<T : Any>

Properties

Link copied to clipboard

All sealed subclasses, recursively.

Link copied to clipboard
val TypeUsage.kotlinType: KType?

Functions

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Boolean.Companion.any(): Arbitrary<Boolean>

Convenience function to create an arbitrary for Boolean.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Byte.Companion.any(): ByteArbitrary

Convenience function to create an arbitrary for Byte.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Char.Companion.any(): CharacterArbitrary

Convenience function to create an arbitrary for Char.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Double.Companion.any(): DoubleArbitrary

Convenience function to create an arbitrary for Double.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
inline fun <T : Enum<T>> Enum.Companion.any(): Arbitrary<T>

Function to create arbitrary for all values of an enum type.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Float.Companion.any(): FloatArbitrary

Convenience function to create an arbitrary for Float.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Int.Companion.any(): IntegerArbitrary

Convenience function to create an arbitrary for Int.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Long.Companion.any(): LongArbitrary

Convenience function to create an arbitrary for Long.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Short.Companion.any(): ShortArbitrary

Convenience function to create an arbitrary for Short in a range.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun String.Companion.any(): StringArbitrary

Convenience function to create an arbitrary for String.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun IntRange.Companion.any(): IntRangeArbitrary

Function to create an arbitrary for IntRange.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Byte.Companion.any(range: IntRange): ByteArbitrary

Convenience function to create an arbitrary for Byte in a range.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Char.Companion.any(range: CharRange): CharacterArbitrary

Convenience function to create an arbitrary for Char in range.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Double.Companion.any(range: ClosedFloatingPointRange<Double>): DoubleArbitrary

Convenience function to create an arbitrary for Double in range.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Float.Companion.any(range: ClosedFloatingPointRange<Float>): FloatArbitrary

Convenience function to create an arbitrary for Float in range.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Int.Companion.any(range: IntRange): IntegerArbitrary

Convenience function to create an arbitrary for Int in range.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Long.Companion.any(range: LongRange): LongArbitrary

Convenience function to create an arbitrary for Long in range.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun Short.Companion.any(range: IntRange): ShortArbitrary

Convenience function to create an arbitrary for Short.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun IntRange.Companion.any(range: IntRange): IntRangeArbitrary

Function to create an arbitrary for IntRange with range.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.8.4")
inline fun <T : Any> anyForSubtypeOf(enableArbitraryRecursion: Boolean = false, crossinline subtypeScope: SubtypeScope<T>.() -> Unit = {}): Arbitrary<T>

Creates Arbitrary with subtypes of a sealed class or interface T. If a subtype is a sealed class or interface, its subtypes are used to create Arbitrary. This is done recursively. TypeArbitrary are created by default under the hood, but this can be customized, for each subtype, with SubtypeScope.provide .

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
inline fun <T : Any> anyForType(): TypeArbitrary<T>

Function to create a TypeArbitrary.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun anyFunction(kClass: KClass<*>): Functions.FunctionWrapper

Function to create a Functions.FunctionWrapper.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <R> anyFunction0(returning: Arbitrary<out R>): FunctionArbitrary<() -> R, out R>

Create a FunctionArbitrary for Kotlin function without parameters.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <A, R> anyFunction1(returning: Arbitrary<out R>): FunctionArbitrary<(A) -> R, out R>

Create a FunctionArbitrary for Kotlin function with 1 parameter.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <A, B, R> anyFunction2(returning: Arbitrary<out R>): FunctionArbitrary<(A, B) -> R, out R>

Create a FunctionArbitrary for Kotlin function with 2 parameters.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <A, B, C, R> anyFunction3(returning: Arbitrary<out R>): FunctionArbitrary<(A, B, C) -> R, out R>

Create a FunctionArbitrary for Kotlin function with 3 parameters.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <A, B, C, D, R> anyFunction4(returning: Arbitrary<out R>): FunctionArbitrary<(A, B, C, D) -> R, out R>

Create a FunctionArbitrary for Kotlin function with 4 parameters.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <A, B> anyPair(firstArbitrary: Arbitrary<A>, secondArbitrary: Arbitrary<B>): Arbitrary<Pair<A, B>>

Function to create an arbitrary for Pair.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.5")
fun <T : Any> Collection<T>.anySubset(): SetArbitrary<T>

Convenience function to replace Arbitraries.subsetOf(..)

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <A, B, C> anyTriple(firstArbitrary: Arbitrary<A>, secondArbitrary: Arbitrary<B>, thirdArbitrary: Arbitrary<C>): Arbitrary<Triple<A, B, C>>

Function to create an arbitrary for Triple.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.7.1")
fun <T : Any> Collection<T>.anyValue(): Arbitrary<T>

Convenience function to replace Arbitraries.of(..)

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
inline fun <T, A : Any> Arbitrary<T>.array(): ArrayArbitrary<T, A>

Create a new arbitrary of type Array using the existing arbitrary for generating the elements of the array.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.8.0")
fun <R> combine(combinator: CombinatorScope.() -> Combined<R>): Arbitrary<R>

Combine arbitraries using the combinator DSL:

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T, R> combine(arbitraries: List<Arbitrary<T>>, filter: (v1: List<T>) -> Boolean? = null, combinator: (v1: List<T>) -> R): Arbitrary<R>

Combine list of arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, R> combine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, filter: (T1, T2) -> Boolean? = null, combinator: (v1: T1, v2: T2) -> R): Arbitrary<R>

Combine 2 arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, T3, R> combine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, a3: Arbitrary<T3>, filter: (v1: T1, v2: T2, v3: T3) -> Boolean? = null, combinator: (v1: T1, v2: T2, v3: T3) -> R): Arbitrary<R>

Combine 3 arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, T3, T4, R> combine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, a3: Arbitrary<T3>, a4: Arbitrary<T4>, filter: (v1: T1, v2: T2, v3: T3, v4: T4) -> Boolean? = null, combinator: (v1: T1, v2: T2, v3: T3, v4: T4) -> R): Arbitrary<R>

Combine 4 arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, T3, T4, T5, R> combine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, a3: Arbitrary<T3>, a4: Arbitrary<T4>, a5: Arbitrary<T5>, filter: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) -> Boolean? = null, combinator: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) -> R): Arbitrary<R>

Combine 5 arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, T3, T4, T5, T6, R> combine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, a3: Arbitrary<T3>, a4: Arbitrary<T4>, a5: Arbitrary<T5>, a6: Arbitrary<T6>, filter: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) -> Boolean? = null, combinator: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) -> R): Arbitrary<R>

Combine 6 arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, T3, T4, T5, T6, T7, R> combine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, a3: Arbitrary<T3>, a4: Arbitrary<T4>, a5: Arbitrary<T5>, a6: Arbitrary<T6>, a7: Arbitrary<T7>, filter: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7) -> Boolean? = null, combinator: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7) -> R): Arbitrary<R>

Combine 7 arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, T3, T4, T5, T6, T7, T8, R> combine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, a3: Arbitrary<T3>, a4: Arbitrary<T4>, a5: Arbitrary<T5>, a6: Arbitrary<T6>, a7: Arbitrary<T7>, a8: Arbitrary<T8>, filter: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8) -> Boolean? = null, combinator: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8) -> R): Arbitrary<R>

Combine 8 arbitraries into one.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
operator fun <A> Tuple.Tuple1<A>.component1(): A
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
operator fun <A, B> Tuple.Tuple2<A, B>.component2(): B
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
operator fun <A, B, C> Tuple.Tuple3<A, B, C>.component3(): C
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
operator fun <A, B, C, D> Tuple.Tuple4<A, B, C, D>.component4(): D
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
operator fun <A, B, C, D, E> Tuple.Tuple5<A, B, C, D, E>.component5(): E
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
operator fun <A, B, C, D, E, F> Tuple.Tuple6<A, B, C, D, E, F>.component6(): F
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
operator fun <A, B, C, D, E, F, G> Tuple.Tuple7<A, B, C, D, E, F, G>.component7(): G
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
operator fun <A, B, C, D, E, F, G, H> Tuple.Tuple8<A, B, C, D, E, F, G, H>.component8(): H
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T, R> flatCombine(arbitraries: List<Arbitrary<T>>, flatCombinator: (v1: List<T>) -> Arbitrary<R>): Arbitrary<R>

Flat-combine list of arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, R> flatCombine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, flatCombinator: (v1: T1, v2: T2) -> Arbitrary<R>): Arbitrary<R>

Flat-combine 2 arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, T3, R> flatCombine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, a3: Arbitrary<T3>, flatCombinator: (v1: T1, v2: T2, v3: T3) -> Arbitrary<R>): Arbitrary<R>

Flat-combine 3 arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, T3, T4, R> flatCombine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, a3: Arbitrary<T3>, a4: Arbitrary<T4>, flatCombinator: (v1: T1, v2: T2, v3: T3, v4: T4) -> Arbitrary<R>): Arbitrary<R>

Flat-combine 4 arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, T3, T4, T5, R> flatCombine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, a3: Arbitrary<T3>, a4: Arbitrary<T4>, a5: Arbitrary<T5>, flatCombinator: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) -> Arbitrary<R>): Arbitrary<R>

Flat-combine 5 arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, T3, T4, T5, T6, R> flatCombine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, a3: Arbitrary<T3>, a4: Arbitrary<T4>, a5: Arbitrary<T5>, a6: Arbitrary<T6>, flatCombinator: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) -> Arbitrary<R>): Arbitrary<R>

Flat-combine 6 arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, T3, T4, T5, T6, T7, R> flatCombine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, a3: Arbitrary<T3>, a4: Arbitrary<T4>, a5: Arbitrary<T5>, a6: Arbitrary<T6>, a7: Arbitrary<T7>, flatCombinator: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7) -> Arbitrary<R>): Arbitrary<R>

Flat-combine 7 arbitraries into one.

@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T1, T2, T3, T4, T5, T6, T7, T8, R> flatCombine(a1: Arbitrary<T1>, a2: Arbitrary<T2>, a3: Arbitrary<T3>, a4: Arbitrary<T4>, a5: Arbitrary<T5>, a6: Arbitrary<T6>, a7: Arbitrary<T7>, a8: Arbitrary<T8>, flatCombine: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8) -> Arbitrary<R>): Arbitrary<R>

Flat-combine 8 arbitraries into one.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.2")
fun <T> frequency(vararg frequencies: Pair<Int, T>): Arbitrary<out T>

Function to create arbitrary that generates one of the provided values with a given frequency.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.2")
fun <T> frequencyOf(vararg frequencies: Pair<Int, Arbitrary<T>>): Arbitrary<out T>

Function to choose from one of the provided arbitraries with a given frequency.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun TypeUsage.isAssignableFrom(kClass: KClass<*>): Boolean
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun StringArbitrary.ofLength(range: IntRange): StringArbitrary

Set the minimum and maximum allowed length of generated strings.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T, A : Any> ArrayArbitrary<T, A>.ofSize(range: IntRange): ArrayArbitrary<T, A>
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T> IteratorArbitrary<T>.ofSize(range: IntRange): IteratorArbitrary<T>
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T> ListArbitrary<T>.ofSize(range: IntRange): ListArbitrary<T>
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <K, V> MapArbitrary<K, V>.ofSize(range: IntRange): MapArbitrary<K, V>
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T> SetArbitrary<T>.ofSize(range: IntRange): SetArbitrary<T>
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T> StreamArbitrary<T>.ofSize(range: IntRange): StreamArbitrary<T>
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T> Arbitrary<T>.orNull(nullProbability: Double): Arbitrary<T?>

Create a new arbitrary of the same type but inject null values with a probability of nullProbability.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T> Arbitrary<T>.pair(): Arbitrary<Pair<T, T>>

Create a new arbitrary for type Pair using the existing arbitrary for generating the elements of the pair.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T> runBlockingProperty(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> T): T

Wrap a property so that it can use asynchronous functions within.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T> Arbitrary<T>.sequence(): SequenceArbitrary<T>

Create a new arbitrary of type SequenceArbitrary using the existing arbitrary for generating the elements of the sequence.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T> Arbitrary<T>.triple(): Arbitrary<Triple<T, T, T>>

Create a new arbitrary for type Triple using the existing arbitrary for generating the elements of the triple.

Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <B : Any, T> Builders.BuilderCombinator<B>.use(arbitrary: Arbitrary<T & Any>, combinator: (B, T) -> B): Builders.BuilderCombinator<B>

Convenience function for Kotlin to not use backticked in function.