TypeFamilyGenerationContext

Context for generating a value from the requested type's type arguments.

Properties

Link copied to clipboard

Fake context for the outer value being generated.

Link copied to clipboard
open override val depth: Int

Current recursion depth.

Link copied to clipboard
open override val index: Int

Index of this value within the parent generator.

Link copied to clipboard
open override val path: FakePath

Full path to the current generated value.

Link copied to clipboard
open override val property: FakeProperty?

Property currently being generated, or null when generating a top-level value.

Link copied to clipboard
open override val random: Random

Random instance derived from seed.

Link copied to clipboard
open override val seed: Long

Deterministic seed for the current generated value.

Link copied to clipboard
open override val type: FakeType

Type currently being generated.

Functions

Link copied to clipboard
fun argumentType(argumentIndex: Int): KType

Returns the requested type argument at argumentIndex.

Link copied to clipboard

Generates an arithmetic exception.

Link copied to clipboard

Generates an assertion error.

Link copied to clipboard

Generates a boolean.

Link copied to clipboard
fun FakeContext.booleanArray(size: Int = int(config(FiktionConfig.Array.size))): BooleanArray

Generates a boolean array.

Link copied to clipboard

Generates a byte across the full byte range.

Generates a byte within range.

fun FakeContext.byte(min: Byte, max: Byte): Byte

Generates a byte from min to max.

Link copied to clipboard
fun FakeContext.byteArray(size: Int = int(config(FiktionConfig.Array.size))): ByteArray

Generates a byte array.

Link copied to clipboard
fun FakeContext.char(charset: FiktionCharset = config(FiktionConfig.Char.charset)): Char

Generates a character from the default alpha-numeric character set.

Generates a character within range.

fun FakeContext.char(min: Char, max: Char): Char

Generates a character from min to max.

Link copied to clipboard
fun FakeContext.charArray(size: Int = int(config(FiktionConfig.Array.size))): CharArray

Generates a character array.

Link copied to clipboard

Generates a finite character progression.

Link copied to clipboard

Generates a finite character range.

Generates a finite character range inside charset.

Generates a finite character range from min to max.

Link copied to clipboard
fun FakeContext.childContext(index: Int, seedIndex: Int = index): FakeContext

Creates a child fake context with separate seed and public index values.

Link copied to clipboard

Generates a class cast exception.

Link copied to clipboard

Generates a concurrent modification exception.

Link copied to clipboard
open override fun <Value : Any> config(key: FiktionConfig<*, Value>): Value

Returns the effective generator configuration for this context.

Link copied to clipboard

Generates a double in 0.0 <= value < 1.0.

Generates a double within range.

Generates a double from min to max.

Link copied to clipboard
fun FakeContext.doubleArray(size: Int = int(config(FiktionConfig.Array.size))): DoubleArray

Generates a double array.

Link copied to clipboard

Generates a finite duration within approximately plus or minus 100 years.

Link copied to clipboard

Generates a duration unit.

Link copied to clipboard
fun FakeContext.error(message: String = string()): Error

Generates an error.

Link copied to clipboard
fun FakeContext.exception(message: String = string()): Exception

Generates an exception.

Link copied to clipboard
fun <T> FakeContext.failureResult(exception: FakeContext.() -> Throwable = { IllegalStateException("Generated failure for ${type.displayName}") }): Result<T>

Generates a failed result from exception.

Link copied to clipboard
fun fake(index: Int, argumentIndex: Int = index): Any?

Generates a value for the type argument at argumentIndex using index as FakeContext.index.

Link copied to clipboard
fun fakeElement(index: Int, argumentIndex: Int = 0): Any?

Generates a collection element from the type argument at argumentIndex.

Link copied to clipboard
fun fakeKey(index: Int, argumentIndex: Int = 0): Any?

Generates a map key from the type argument at argumentIndex.

Link copied to clipboard
fun fakeValue(index: Int, argumentIndex: Int = 1): Any?

Generates a map value from the type argument at argumentIndex.

Link copied to clipboard

Generates a float in 0.0 <= value < 1.0.

Generates a float within range.

fun FakeContext.float(min: Float, max: Float): Float

Generates a float from min to max.

Link copied to clipboard
fun FakeContext.floatArray(size: Int = int(config(FiktionConfig.Array.size))): FloatArray

Generates a float array.

Link copied to clipboard

Generates an illegal argument exception.

Link copied to clipboard

Generates an illegal state exception.

Link copied to clipboard

Generates an index out of bounds exception.

Link copied to clipboard

Generates an instant from 2000-01-01T00:00:00Z until 2100-01-01T00:00:00Z.

Link copied to clipboard

Generates an integer across the full integer range.

Generates an integer within range.

fun FakeContext.int(min: Int, max: Int): Int

Generates an integer from min to max.

Link copied to clipboard
fun FakeContext.intArray(size: Int = int(config(FiktionConfig.Array.size))): IntArray

Generates an integer array.

Link copied to clipboard

Generates a finite integer progression.

Link copied to clipboard

Generates a finite integer range.

Generates a finite integer range from min to max.

Link copied to clipboard
fun <T> FakeContext.list(size: Int = int(config(FiktionConfig.Collection.size)), element: FakeContext.() -> T): List<T>

Generates a list using element.

Link copied to clipboard

Generates a long across the full long range.

Generates a long within range.

fun FakeContext.long(min: Long, max: Long): Long

Generates a long from min to max.

Link copied to clipboard
fun FakeContext.longArray(size: Int = int(config(FiktionConfig.Array.size))): LongArray

Generates a long array.

Link copied to clipboard

Generates a finite long progression.

Link copied to clipboard

Generates a finite long range.

Generates a finite long range from min to max.

Link copied to clipboard
fun <K, V> FakeContext.map(size: Int = int(config(FiktionConfig.Map.size)), key: FakeContext.() -> K, value: FakeContext.() -> V): Map<K, V>

Generates a map using key and value.

Link copied to clipboard
fun <T> FakeContext.mutableList(size: Int = int(config(FiktionConfig.Collection.size)), element: FakeContext.() -> T): MutableList<T>

Generates a mutable list using element.

Link copied to clipboard
fun <K, V> FakeContext.mutableMap(size: Int = int(config(FiktionConfig.Map.size)), key: FakeContext.() -> K, value: FakeContext.() -> V): MutableMap<K, V>

Generates a mutable map using key and value.

Link copied to clipboard
fun <T> FakeContext.mutableSet(size: Int = int(config(FiktionConfig.Collection.size)), element: FakeContext.() -> T): MutableSet<T>

Generates a mutable set using element.

Link copied to clipboard

Generates a no such element exception.

Link copied to clipboard

Generates a null pointer exception.

Link copied to clipboard

Generates a number format exception.

Link copied to clipboard
fun <T> FakeContext.oneOf(values: List<T>): T
fun <T> FakeContext.oneOf(vararg values: T): T

Chooses one value from values.

Link copied to clipboard

Generates a pair from first and second.

Link copied to clipboard
fun FakeContext.regex(length: Int = int(config(FiktionConfig.Regex.length)), charset: FiktionCharset = config(FiktionConfig.Regex.charset)): Regex

Generates a regex whose pattern is a literal alpha-numeric string.

Link copied to clipboard
fun <T> FakeContext.result(failureProbability: Probability = 50.percent, exception: FakeContext.() -> Throwable = { IllegalStateException("Generated failure for ${type.displayName}") }, value: FakeContext.() -> T): Result<T>

Generates a result that fails according to failureProbability.

Link copied to clipboard

Generates a runtime exception.

Link copied to clipboard
fun <T> FakeContext.sequence(size: Int = int(config(FiktionConfig.Collection.size)), element: FakeContext.() -> T): Sequence<T>

Generates a finite sequence using element.

Link copied to clipboard
fun <T> FakeContext.set(size: Int = int(config(FiktionConfig.Collection.size)), element: FakeContext.() -> T): Set<T>

Generates a set using element.

Link copied to clipboard

Generates a short across the full short range.

Generates a short within range.

fun FakeContext.short(min: Short, max: Short): Short

Generates a short from min to max.

Link copied to clipboard
fun FakeContext.shortArray(size: Int = int(config(FiktionConfig.Array.size))): ShortArray

Generates a short array.

Link copied to clipboard
fun FakeContext.string(length: Int, charset: FiktionCharset = config(FiktionConfig.String.charset)): String

Generates a string with length characters using charset.

fun FakeContext.string(length: ClosedRange<Int> = config(FiktionConfig.String.length), charset: FiktionCharset = config(FiktionConfig.String.charset)): String

Generates a string with a random length from length using charset.

Link copied to clipboard

Generates a successful result from value.

Link copied to clipboard
fun FakeContext.throwable(message: String = string()): Throwable

Generates a throwable.

Link copied to clipboard

Generates a triple from first, second, and third.

Link copied to clipboard

Generates an unsigned byte across the full unsigned byte range.

Generates an unsigned byte within range.

fun FakeContext.ubyte(min: UByte, max: UByte): UByte

Generates an unsigned byte from min to max.

Link copied to clipboard
fun FakeContext.ubyteArray(size: Int = int(config(FiktionConfig.Array.size))): UByteArray

Generates an unsigned byte array.

Link copied to clipboard

Generates an unsigned integer across the full unsigned integer range.

Generates an unsigned integer within range.

fun FakeContext.uint(min: UInt, max: UInt): UInt

Generates an unsigned integer from min to max.

Link copied to clipboard
fun FakeContext.uintArray(size: Int = int(config(FiktionConfig.Array.size))): UIntArray

Generates an unsigned integer array.

Link copied to clipboard

Generates a finite unsigned integer progression.

Link copied to clipboard

Generates a finite unsigned integer range.

Generates a finite unsigned integer range from min to max.

Link copied to clipboard

Generates an unsigned long across the full unsigned long range.

Generates an unsigned long within range.

fun FakeContext.ulong(min: ULong, max: ULong): ULong

Generates an unsigned long from min to max.

Link copied to clipboard
fun FakeContext.ulongArray(size: Int = int(config(FiktionConfig.Array.size))): ULongArray

Generates an unsigned long array.

Link copied to clipboard

Generates a finite unsigned long progression.

Link copied to clipboard

Generates a finite unsigned long range.

Generates a finite unsigned long range from min to max.

Link copied to clipboard

Generates the unit value.

Link copied to clipboard

Generates an unsupported operation exception.

Link copied to clipboard

Generates an unsigned short across the full unsigned short range.

Generates an unsigned short within range.

Generates an unsigned short from min to max.

Link copied to clipboard
fun FakeContext.ushortArray(size: Int = int(config(FiktionConfig.Array.size))): UShortArray

Generates an unsigned short array.

Link copied to clipboard

Generates a deterministic UUID from the current fake context seed.