Package net.jqwik.kotlin.api

Types

IntRangeArbitrary
Link copied to clipboard
data class IntRangeArbitrary(min: Int, max: Int, minSize: Int, maxSize: Int) : ArbitraryDecorator<IntRange> , SizableArbitrary<IntRange>
JqwikCharRange
Link copied to clipboard
typealias JqwikCharRange = CharRange
JqwikIntRange
Link copied to clipboard
typealias JqwikIntRange = IntRange
JqwikLongRange
Link copied to clipboard
typealias JqwikLongRange = LongRange
JqwikShortRange
Link copied to clipboard
typealias JqwikShortRange = ShortRange
SequenceArbitrary
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

Functions

any
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.

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

Function to create a TypeArbitrary.

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

Function to create a FunctionWrapper.

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

Create a FunctionArbitrary for Kotlin function without parameters.

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

Create a FunctionArbitrary for Kotlin function with 1 parameter.

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

Create a FunctionArbitrary for Kotlin function with 2 parameters.

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

Create a FunctionArbitrary for Kotlin function with 3 parameters.

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

Create a FunctionArbitrary for Kotlin function with 4 parameters.

anyPair
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.

anyTriple
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.

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

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

combine
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T, R> combine(arbitraries: List<Arbitrary<T>>, 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>, combinator: (T1, 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>, combinator: (T1, T2, 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>, combinator: (T1, T2, T3, 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>, combinator: (T1, T2, T3, T4, 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>, combinator: (T1, T2, T3, T4, T5, 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>, combinator: (T1, T2, T3, T4, T5, T6, 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>, combinator: (T1, T2, T3, T4, T5, T6, T7, T8) -> R): Arbitrary<R>

Combine 8 arbitraries into one.

component1
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
operator fun <A> Tuple.Tuple1<A>.component1(): A
component2
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
operator fun <A, B> Tuple.Tuple2<A, B>.component2(): B
component3
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
component4
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
component5
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
component6
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
component7
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
component8
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
flatCombine
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: (T1, 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: (T1, T2, 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: (T1, T2, T3, 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: (T1, T2, T3, T4, 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: (T1, T2, T3, T4, T5, 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: (T1, T2, T3, T4, T5, T6, 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: (T1, T2, T3, T4, T5, T6, T7, T8) -> Arbitrary<R>): Arbitrary<R>

Flat-combine 8 arbitraries into one.

isAssignableFrom
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun TypeUsage.isAssignableFrom(kClass: KClass<*>): Boolean
ofLength
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.

ofSize
Link copied to clipboard
@API(status = API.Status.EXPERIMENTAL, since = "1.6.0")
fun <T, A> 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>
orNull
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.

pair
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.

runBlockingProperty
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.

sequence
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.

triple
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.

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

Convenience function for Kotlin to not use backticked in function.

Properties

kotlinType
Link copied to clipboard
val TypeUsage.kotlinType: KType?