Best Kotest code snippet using io.kotest.property.exhaustive.Exhaustive.Exhaustive.Companion.of
GenHelper.kt
Source:GenHelper.kt
1/*2 * Copyright (c) 2020 sparetimedevs and respective authors and developers.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16package com.sparetimedevs.pofpaf.test.generator17import arrow.core.Either18import arrow.core.left19import arrow.core.right20import com.microsoft.azure.functions.HttpMethod21import com.sparetimedevs.pofpaf.test.implementation.general.log.Level22import io.kotest.property.Arb23import io.kotest.property.Exhaustive24import io.kotest.property.arbitrary.bool25import io.kotest.property.arbitrary.byte26import io.kotest.property.arbitrary.choice27import io.kotest.property.arbitrary.create28import io.kotest.property.arbitrary.double29import io.kotest.property.arbitrary.element30import io.kotest.property.arbitrary.file31import io.kotest.property.arbitrary.float32import io.kotest.property.arbitrary.int33import io.kotest.property.arbitrary.localDate34import io.kotest.property.arbitrary.localDateTime35import io.kotest.property.arbitrary.localTime36import io.kotest.property.arbitrary.long37import io.kotest.property.arbitrary.map38import io.kotest.property.arbitrary.next39import io.kotest.property.arbitrary.period40import io.kotest.property.arbitrary.short41import io.kotest.property.arbitrary.string42import io.kotest.property.arbitrary.uuid43import io.kotest.property.exhaustive.exhaustive44import java.net.URI45fun Arb.Companion.suspendFunThatReturnsEitherAnyOrAnyOrThrows(): Arb<suspend () -> Either<Any, Any>> =46 choice(47 suspendFunThatReturnsAnyRight(),48 suspendFunThatReturnsAnyLeft(),49 suspendFunThatThrows()50 )51fun Arb.Companion.suspendFunThatReturnsEitherAnyOrUnitOrThrows(): Arb<suspend () -> Either<Any, Unit>> =52 choice(53 suspendFunThatReturnsUnitRight() as Arb<suspend () -> Either<Any, Unit>>,54 suspendFunThatReturnsAnyLeft() as Arb<suspend () -> Either<Any, Unit>>,55 suspendFunThatThrows() as Arb<suspend () -> Either<Any, Unit>>56 )57fun Arb.Companion.suspendFunThatReturnsUnitRight(): Arb<suspend () -> Either<Any, Unit>> =58 unit().map { suspend { it.right() } }59fun Arb.Companion.suspendFunThatReturnsAnyRight(): Arb<suspend () -> Either<Any, Any>> =60 any().map { suspend { it.right() } }61fun Arb.Companion.suspendFunThatReturnsAnyLeft(): Arb<suspend () -> Either<Any, Any>> =62 any().map { suspend { it.left() } }63fun Arb.Companion.suspendFunThatThrows(): Arb<suspend () -> Either<Any, Any>> =64 throwable().map { suspend { throw it } } as Arb<suspend () -> Either<Any, Any>>65fun Arb.Companion.suspendFunThatThrowsFatalThrowable(): Arb<suspend () -> Either<Any, Any>> =66 fatalThrowable().map { suspend { throw it } } as Arb<suspend () -> Either<Any, Any>>67fun Arb.Companion.throwable(): Arb<Throwable> =68 element(69 Exception(),70 RuntimeException(),71 IllegalArgumentException(),72 IllegalStateException(),73 IndexOutOfBoundsException(),74 UnsupportedOperationException(),75 ArithmeticException(),76 NumberFormatException(),77 NullPointerException(),78 ClassCastException(),79 AssertionError(),80 NoSuchElementException(),81 ConcurrentModificationException()82 )83fun Arb.Companion.fatalThrowable(): Arb<Throwable> =84 element(85 MyVirtualMachineError(),86 ThreadDeath(),87 InterruptedException(),88 LinkageError()89 )90class MyVirtualMachineError : VirtualMachineError()91fun Arb.Companion.any(): Arb<Any> =92 choice(93 string() as Arb<Any>,94 int() as Arb<Any>,95 short() as Arb<Any>,96 long() as Arb<Any>,97 float() as Arb<Any>,98 double() as Arb<Any>,99 bool() as Arb<Any>,100 byte() as Arb<Any>,101 uuid() as Arb<Any>,102 file() as Arb<Any>,103 localDate() as Arb<Any>,104 localTime() as Arb<Any>,105 localDateTime() as Arb<Any>,106 period() as Arb<Any>,107 throwable() as Arb<Any>,108 fatalThrowable() as Arb<Any>,109 mapOfStringAndStringGenerator() as Arb<Any>,110 uri() as Arb<Any>,111 httpMethod() as Arb<Any>,112 unit() as Arb<Any>113 )114fun Arb.Companion.unit(): Arb<Unit> =115 create { Unit }116fun Arb.Companion.mapOfStringAndStringGenerator(): Arb<Map<String, String>> =117 element(118 listOf(119 emptyMap(),120 mapOf(121 string().next() to string().next()122 ),123 mapOf(124 string().next() to string().next(),125 string().next() to string().next()126 ),127 mapOf(128 string().next() to string().next(),129 string().next() to string().next(),130 string().next() to string().next()131 ),132 mapOf(133 string().next() to string().next(),134 string().next() to string().next(),135 string().next() to string().next(),136 string().next() to string().next(),137 string().next() to string().next(),138 string().next() to string().next()139 ),140 mapOf(141 string().next() to string().next(),142 string().next() to string().next(),143 string().next() to string().next(),144 string().next() to string().next(),145 string().next() to string().next(),146 string().next() to string().next(),147 string().next() to string().next(),148 string().next() to string().next(),149 string().next() to string().next(),150 string().next() to string().next(),151 string().next() to string().next(),152 string().next() to string().next()153 ),154 mapOf(155 string().next() to string().next(),156 string().next() to string().next(),157 string().next() to string().next(),158 string().next() to string().next(),159 string().next() to string().next(),160 string().next() to string().next(),161 string().next() to string().next(),162 string().next() to string().next(),163 string().next() to string().next(),164 string().next() to string().next(),165 string().next() to string().next(),166 string().next() to string().next(),167 string().next() to string().next(),168 string().next() to string().next(),169 string().next() to string().next(),170 string().next() to string().next(),171 string().next() to string().next(),172 string().next() to string().next(),173 string().next() to string().next(),174 string().next() to string().next(),175 string().next() to string().next(),176 string().next() to string().next(),177 string().next() to string().next(),178 string().next() to string().next()179 )180 )181 )182fun Arb.Companion.uri(): Arb<URI> =183 element(184 listOf(185 URI.create("https://sparetimedevs.com"),186 URI.create("https://www.sparetimedevs.com"),187 URI.create("https://something.sparetimedevs.com"),188 URI.create("https://something.sparetimedevs.com/another/thing"),189 URI.create("https://something.sparetimedevs.com/another/thing?query=param")190 )191 )192fun Arb.Companion.httpMethod(): Arb<HttpMethod> =193 element(194 listOf(195 HttpMethod.GET,196 HttpMethod.HEAD,197 HttpMethod.POST,198 HttpMethod.PUT,199 HttpMethod.DELETE,200 HttpMethod.CONNECT,201 HttpMethod.OPTIONS,202 HttpMethod.TRACE203 )204 )205fun Exhaustive.Companion.logLevel(): Exhaustive<Level> =206 listOf(207 Level.INFO,208 Level.DEBUG,209 Level.WARN,210 Level.ERROR211 ).exhaustive()212fun Arb.Companion.stringOrNull(): Arb<String?> =213 choice(214 string() as Arb<String?>,215 create { null } as Arb<String?>216 )...
CashRegisterTest.kt
Source:CashRegisterTest.kt
1package exercies.chapter12import io.kotest.core.spec.style.FunSpec3import io.kotest.matchers.shouldBe4import io.kotest.property.Arb5import io.kotest.property.Exhaustive6import io.kotest.property.arbitrary.arbitrary7import io.kotest.property.arbitrary.bind8import io.kotest.property.arbitrary.double9import io.kotest.property.arbitrary.map10import io.kotest.property.arbitrary.of11import io.kotest.property.checkAll12import io.kotest.property.exhaustive.boolean13class CashRegisterTest : FunSpec(14 {15 context("No item purchased, costs nothing") {16 checkAll(Arb.itemConfiguration()) { config ->17 CashRegister.of(config).checkout(emptyList()) shouldBe PayableAmount(0.0)18 }19 }20 context("Uses discount when purchasing the amount to get") {21 checkAll(22 Arb.itemConfiguration(),23 Exhaustive.boolean()24 ) { (item, price, discount), randomItemIncluded ->25 val randomItem = Item("jukebox")26 val register = CashRegister(item, price, discount) + ItemConfiguration(27 randomItem,28 PayableAmount(0.1),29 Discount(1, 1)30 )31 val purchasesToUsePromotion = (1..discount.get).map { item }32 // Non-promotion item in the middle of things should not affect other promotions33 val purchases =34 if (!randomItemIncluded) purchasesToUsePromotion35 else listOf(item, randomItem) + item * (discount.get - 1)36 register.checkout(purchases) shouldBe PayableAmount(discount.payFor * price.value + if (randomItemIncluded) 0.1 else 0.0)37 }38 }39 context("Buy less than promotion, pay full price") {40 checkAll(Arb.itemConfiguration()) { (item, price, discount) ->41 CashRegister(item, price, discount)42 .checkout(item * (discount.get - 1)) shouldBe PayableAmount((discount.get - 1) * price.value)43 }44 }45 context("Use promotion and then buy one extra") {46 checkAll(Arb.itemConfiguration()) { (item, price, discount) ->47 CashRegister(item, price, discount)48 .checkout(item * (discount.get + 1)) shouldBe PayableAmount((discount.payFor + 1) * price.value)49 }50 }51 }52)53val items =54 listOf(55 Item("milk"),56 Item("eggs"),57 Item("cheese"),58 Item("coffee"),59 Item("mustard"),60 Item("ham"),61 )62fun Arb.Companion.item(excludedItems: Set<Item> = emptySet()) = Arb.of(items - excludedItems)63fun Arb.Companion.price() = Arb.double(0.1, 100.0).map { PayableAmount(it) }64fun Arb.Companion.discount() = arbitrary { rs ->65 val payFor = rs.random.nextInt(1, 20)66 val get = rs.random.nextInt(payFor + 1, 40)67 Discount(get, payFor)68}69fun Arb.Companion.itemConfiguration() =70 Arb.bind(Arb.item(), Arb.price(), Arb.discount()) { item, price, discount ->71 ItemConfiguration(item, price, discount)72 }...
NotePitchTest.kt
Source:NotePitchTest.kt
1package io.loskunos.midi2import io.kotest.data.forAll3import io.kotest.data.row4import io.kotest.matchers.collections.shouldContainExactly5import io.kotest.matchers.shouldBe6import io.kotest.property.Arb7import io.kotest.property.Exhaustive8import io.kotest.property.arbitrary.element9import io.kotest.property.arbitrary.list10import io.kotest.property.checkAll11import io.kotest.property.exhaustive.collection12import io.kotest.property.exhaustive.enum13import io.loskunos.midi.Octave.Companion.o014import io.loskunos.midi.Octave.Companion.o115import io.loskunos.midi.Octave.Companion.o216import io.loskunos.midi.Octave.Companion.o317import io.loskunos.midi.Octave.Companion.o418import io.loskunos.midi.Octave.Companion.o519import io.loskunos.midi.Octave.Companion.o620import io.loskunos.midi.Octave.Companion.o721import io.loskunos.midi.Octave.Companion.o822import io.loskunos.midi.PitchClass.C23import kotlinx.coroutines.runBlocking24import org.junit.jupiter.api.Nested25import org.junit.jupiter.api.Test26class NotePitchTest {27 private val allPitchClassInstances = PitchClass::class.sealedSubclasses.map { it.objectInstance!! }28 @Nested29 inner class PitchClassToNotePitch {30 @Test31 fun `should be the same note`() {32 runBlocking {33 checkAll(Exhaustive.collection(allPitchClassInstances)) { pitchClass ->34 pitchClass.octave(o1).pitchClass shouldBe pitchClass35 }36 }37 }38 @Test39 fun `should have given octave`() {40 runBlocking {41 checkAll(Exhaustive.enum<Octave>()) { givenOctave ->42 C.octave(givenOctave) shouldBe NotePitch(C, givenOctave)43 }44 }45 }46 }47 @Test48 fun `adding octave to a list of PitchClasses returns a list of NotePitches with correct octave`() {49 runBlocking {50 checkAll(iterations = 10, Arb.list(Arb.element(allPitchClassInstances), range = 0..10)) { pitchClasses ->51 checkAll(Exhaustive.enum<Octave>()) { givenOctave ->52 forAll(53 row { octave(givenOctave, *pitchClasses.toTypedArray()) },54 row { octave(givenOctave) { pitchClasses } },55 row { pitchClasses.octave(givenOctave) }56 ) { octaveFun ->57 val result = octaveFun()58 result.map { it.octave }.forEach { it shouldBe givenOctave }59 result.map { it.pitchClass } shouldContainExactly pitchClasses60 }61 }62 }63 }64 }65 @Test66 fun `o0-o8 functions should return NotePitch with correct octave`() {67 C.o0.octave shouldBe o068 C.o1.octave shouldBe o169 C.o2.octave shouldBe o270 C.o3.octave shouldBe o371 C.o4.octave shouldBe o472 C.o5.octave shouldBe o573 C.o6.octave shouldBe o674 C.o7.octave shouldBe o775 C.o8.octave shouldBe o876 }77}...
Generators.kt
Source:Generators.kt
1import io.kotest.property.Arb2import io.kotest.property.Gen3import io.kotest.property.Shrinker4import io.kotest.property.arbitrary.*5import io.kotest.property.exhaustive.exhaustive6import org.lwjgl.glfw.GLFW7import kotlin.random.nextInt8fun Arb.Companion.primitiveModel(): Arb<Model> = Arb.bind(9 Arb.numericDoubles(-1.0, 1.0),10 Arb.numericDoubles(-1.0, 1.0),11 Arb.positiveDoubles(),12 Arb.positiveDoubles(),13 Arb.positiveDoubles(),14 Arb.quadtree(1),15) { offsetX, offsetY, zoom, windowWidth, windowHeight, leaf ->16 Model(17 offset = Vec2.screen(offsetX, offsetY),18 zoom = zoom,19 windowSize = Vec2.screen(windowWidth, windowHeight),20 palette = PaletteModel(1.0, 1.0),21 currentColour = Colour.white,22 world = leaf,23 )24}25fun Arb.Companion.fullModel(depth: Int): Arb<Model> = Arb.bind(26 Arb.primitiveModel(),27 Arb.quadtree(depth),28) { model, tree -> model.copy(world = tree) }29val zeroToOne = Arb.numericDoubles(0.0, 1.0)30fun Arb.Companion.colour(): Arb<Colour> = Arb.bind(31 zeroToOne, zeroToOne, zeroToOne, zeroToOne,32) { h, s, l, a -> Colour(h, s, l, a) }33fun Arb.Companion.quadtree(depth: Int): Arb<Quadtree> = arbitrary(TreeShrinker) { rs ->34 when (depth) {35 1 -> Leaf(Arb.colour().sample(rs).value)36 else -> {37 val deep = rs.random.nextInt(1..4)38 val children = Arb39 .quadtree(depth - 1)40 .many(4)41 .mapIndexed { i, deepArb ->42 val arb = if (i != deep && rs.random.nextDouble() < 0.5) Arb.quadtree(1)43 else deepArb44 arb.sample(rs).value45 }46 Node(children.toTypedArray())47 }48 }49}50object TreeShrinker : Shrinker<Quadtree> {51 override fun shrink(value: Quadtree): List<Quadtree> = when (value) {52 is Leaf -> listOf()53 is Node -> value.children.asList()54 }55}56fun GLFWAction.Companion.gen(): Gen<GLFWAction> = exhaustive(GLFWAction.values().asList())57fun CursorEvent.Companion.arb(): Arb<CursorEvent> = Arb.bind(58 Arb.positiveDoubles(), Arb.positiveDoubles(),59) { x, y -> CursorEvent(Vec2.screen(x, y)) }60fun KeyEvent.Companion.arb(): Arb<KeyEvent> = Arb.bind(61 Arb.int(0..1000), GLFWAction.gen()62) { key, action -> KeyEvent(key, GLFW.glfwGetKeyScancode(key), action, 0) }63fun MouseEvent.Companion.arb(): Arb<MouseEvent> = Arb.bind(64 Arb.int(0..5), GLFWAction.gen(),65) { button, action -> MouseEvent(button, action, 0) }66fun ScrollEvent.Companion.arb(): Arb<ScrollEvent> = Arb.bind(67 Arb.numericDoubles(-2.0, 2.0), Arb.numericDoubles(-2.0, 2.0),68) { vert, hor -> ScrollEvent(vert, hor) }69fun ResizeEvent.Companion.arb(): Arb<ResizeEvent> = Arb.bind(70 Arb.int(0..4000), Arb.int(0..4000),71) { w, h -> ResizeEvent(w, h) }72fun Arb.Companion.event(): Arb<Event> = Arb.choose(73 100 to CursorEvent.arb(),74 1 to KeyEvent.arb(),75 20 to MouseEvent.arb(),76 5 to ScrollEvent.arb(),77 1 to ResizeEvent.arb(),78)...
RequestGen.kt
Source:RequestGen.kt
1package com.alessandrocandolini2import io.kotest.property.Arb3import io.kotest.property.Exhaustive4import io.kotest.property.Gen5import io.kotest.property.arbitrary.bind6import io.kotest.property.arbitrary.choice7import io.kotest.property.arbitrary.filter8import io.kotest.property.arbitrary.string9import io.kotest.property.exhaustive.collection10import okhttp3.HttpUrl11import okhttp3.Request12import okhttp3.RequestBody.Companion.toRequestBody13internal object RequestGen {14 private enum class HttpMethod {15 POST, PATCH, DELETE, PUT, GET, HEAD16 }17 private val nonEmptyBodyGen: Arb<String> = Arb.string().filter { it.isNotBlank() }18 fun requestGen(pathToFullUrl: (String) -> HttpUrl): Gen<Request> {19 val httpUrlGen: Gen<HttpUrl> = Exhaustive.collection(setOf(20 "/api/v1/",21 "/api?api=test&appid=something",22 "/api?api=test"23 ).map { u -> pathToFullUrl(u) })24 return requestGen(httpUrlGen)25 }26 fun requestGen(27 httpUrlGen: Gen<HttpUrl>,28 bodyGen: Gen<String> = nonEmptyBodyGen,29 ): Gen<Request> {30 fun HttpMethod.toOkHttpMethodName() = name.toUpperCase()31 val httpMethodWithBodyGen: Gen<HttpMethod> = Exhaustive.collection(32 setOf(33 HttpMethod.POST,34 HttpMethod.PATCH,35 HttpMethod.DELETE,36 HttpMethod.PUT37 )38 )39 val httpMethodWithoutBodyGen: Gen<HttpMethod> =40 Exhaustive.collection(setOf(HttpMethod.GET, HttpMethod.HEAD))41 val requestsWithBody: Arb<Request> = Arb.bind(42 httpUrlGen,43 httpMethodWithBodyGen,44 bodyGen45 ) { httpUrl, httpMethod, body ->46 Request.Builder()47 .method(httpMethod.toOkHttpMethodName(), body.toRequestBody())48 .url(httpUrl)49 .build()50 }51 val requestsWithoutBody: Arb<Request> =52 Arb.bind(httpUrlGen, httpMethodWithoutBodyGen) { httpUrl, httpMethod ->53 Request.Builder()54 .method(httpMethod.toOkHttpMethodName(), null)55 .url(httpUrl)56 .build()57 }58 return Arb.choice(59 requestsWithBody, requestsWithoutBody60 )61 }62}...
Exhaustive.kt
Source:Exhaustive.kt
1package utils2import io.kotest.property.Arb3import io.kotest.property.Exhaustive4import io.kotest.property.Gen5import io.kotest.property.RandomSource6import io.kotest.property.arbitrary.byte7import io.kotest.property.arbitrary.next8import io.kotest.property.exhaustive.exhaustive9import io.kotest.property.exhaustive.filter10import io.kotest.property.exhaustive.ints11import io.kotest.property.exhaustive.map12fun <N : Number> Exhaustive<N>.toInt() = map { it.toInt() }13fun <N : Number> Exhaustive<N>.toShort() = map { it.toShort() }14fun Exhaustive.Companion.shorts(min: Short = Short.MIN_VALUE, max: Short = Short.MAX_VALUE) =15 Exhaustive.ints(min..max).map { it.toShort() }16fun Exhaustive.Companion.ubytes(min: UByte = UByte.MIN_VALUE, max: UByte = UByte.MAX_VALUE): Exhaustive<UByte> =17 Exhaustive.ints(min.toInt()..max.toInt()).map { it.toUByte() }18fun Exhaustive.Companion.ushorts(min: UShort = UShort.MIN_VALUE, max: UShort = UShort.MAX_VALUE): Exhaustive<UShort> =19 Exhaustive.ints(min.toInt()..max.toInt()).map { it.toUShort() }20fun Exhaustive.Companion.byteArrays(length: IntRange, byte: Gen<Byte> = Arb.byte()): Exhaustive<ByteArray> {21 val generator = byte.generate(RandomSource.Default).iterator()22 return length.map { ByteArray(it) { generator.next().value } }.exhaustive()23}24operator fun <A> Exhaustive<A>.minus(other: Exhaustive<A>) =25 filter { it !in other.values }26inline fun <reified T> Exhaustive.Companion.arrayOf(value: Arb<T>, length: IntRange): Exhaustive<Array<T>> {27 return length.map { Array(it) { value.next() } }.exhaustive()28}...
Arb.kt
Source:Arb.kt
1package utils2import io.kotest.property.Arb3import io.kotest.property.Exhaustive4import io.kotest.property.arbitrary.arbitrary5import io.kotest.property.arbitrary.byte6import io.kotest.property.arbitrary.byteArrays7import io.kotest.property.arbitrary.filter8import io.kotest.property.arbitrary.int9import io.kotest.property.arbitrary.merge10import kotlin.random.nextUInt11import kotlin.random.nextULong12operator fun <A> Arb<A>.plus(other: Arb<A>) =13 merge(other)14operator fun <A> Arb<A>.minus(other: Exhaustive<A>) =15 filter { it !in other.values }16operator fun <V : Comparable<V>> Arb<V>.minus(range: ClosedRange<V>) =17 filter { it !in range }18fun Arb.Companion.byteArrays(length: Int) =19 byteArrays(length..length)20fun Arb.Companion.byteArrays(length: IntRange) =21 Arb.byteArrays(Arb.int(length), Arb.byte())22fun Arb.Companion.uint(range: UIntRange = UInt.MIN_VALUE..UInt.MAX_VALUE) = arbitrary(listOf(range.first, range.last)) {23 it.random.nextUInt(range)24}25fun Arb.Companion.ulong() = arbitrary(listOf(ULong.MIN_VALUE, ULong.MAX_VALUE)) {26 it.random.nextULong()27}28inline fun <reified T> Arb.Companion.arrayOf(value: Arb<T>, length: IntRange): Arb<Array<T>> = arbitrary { rs ->29 Array(rs.random.nextInt(length.first, length.last)) {30 value.sample(rs).value31 }32}...
option.kt
Source:option.kt
1package io.kotest.property.arrow2import arrow.core.None3import arrow.core.Option4import arrow.core.Some5import arrow.core.some6import io.kotest.property.Arb7import io.kotest.property.Exhaustive8import io.kotest.property.arbitrary.constant9import io.kotest.property.arbitrary.map10import io.kotest.property.arbitrary.merge11import io.kotest.property.exhaustive.exhaustive12/**13 * Returns an Exhaustive that contains a None and a Some with the given value14 */15fun <A> Exhaustive.Companion.option(a: A) = exhaustive(listOf(None, Some(a)))16fun <A> Exhaustive.Companion.none() = exhaustive(listOf(None))17/**18 * Wraps each element generated by the given Arb in a Some.19 */20fun <A> Arb.Companion.some(arb: Arb<A>): Arb<Option<A>> = arb.map { it.some() }21fun <A> Arb.Companion.none(): Arb<Option<A>> = Arb.constant(None)22fun <A> Arb.Companion.option(arb: Arb<A>): Arb<Option<A>> = some(arb).merge(none())...
Exhaustive.Companion.of
Using AI Code Generation
1val exhaustive = Exhaustive.of(1, 2, 3)2val exhaustive = Exhaustive.of(1, 2, 3, 4)3val exhaustive = Exhaustive.of(1, 2, 3, 4, 5)4val exhaustive = Exhaustive.of(1, 2, 3, 4, 5, 6)5val exhaustive = Exhaustive.of(1, 2, 3, 4, 5, 6, 7)6val exhaustive = Exhaustive.of(1, 2, 3, 4, 5, 6, 7, 8)7val exhaustive = Exhaustive.of(1, 2, 3, 4, 5, 6, 7, 8, 9)8val exhaustive = Exhaustive.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)9val exhaustive = Exhaustive.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)10val exhaustive = Exhaustive.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
Exhaustive.Companion.of
Using AI Code Generation
1val exhaustive = Exhaustive . of ( 1 , 2 , 3 , 4 , 5 )2val exhaustive = Exhaustive . of ( 'a' , 'b' , 'c' , 'd' , 'e' )3val exhaustive = Exhaustive . of ( "a" , "b" , "c" , "d" , "e" )4val exhaustive = Exhaustive . of ( 1.0 , 2.0 , 3.0 , 4.0 , 5.0 )5val exhaustive = Exhaustive . of ( 1.0f , 2.0f , 3.0f , 4.0f , 5.0f )6val exhaustive = Exhaustive . of ( true , false )7val exhaustive = Exhaustive . of ( 1L , 2L , 3L , 4L , 5L )8val exhaustive = Exhaustive . of ( 1.0.toBigDecimal() , 2.0.toBigDecimal() , 3.0.toBigDecimal() , 4.0.toBigDecimal() , 5.0.toBigDecimal() )9val exhaustive = Exhaustive . of ( 1.0.toBigInteger() , 2.0.toBigInteger() , 3.0.toBigInteger() , 4.0.toBigInteger() , 5.0.toBigInteger() )
Exhaustive.Companion.of
Using AI Code Generation
1import io.kotest.property.exhaustive.Exhaustive2val exhaustive = Exhaustive.of(1, 2, 3)3import io.kotest.property.exhaustive.Exhaustive4val exhaustive = Exhaustive.of(1, 2, 3)5import io.kotest.property.exhaustive.Exhaustive6val exhaustive = Exhaustive.of(1, 2, 3)7import io.kotest.property.exhaustive.Exhaustive8val exhaustive = Exhaustive.of(1, 2, 3)9import io.kotest.property.exhaustive.Exhaustive10val exhaustive = Exhaustive.of(1, 2, 3)11import io.kotest.property.exhaustive.Exhaustive12val exhaustive = Exhaustive.of(1, 2, 3)13import io.kotest.property.exhaustive.Exhaustive14val exhaustive = Exhaustive.of(1, 2, 3)15import io.kotest.property.exhaustive.Exhaustive16val exhaustive = Exhaustive.of(1, 2, 3)17import io.kotest.property.exhaustive.Exhaustive18val exhaustive = Exhaustive.of(1, 2, 3)19import io.kotest.property.exhaustive.Exhaustive20val exhaustive = Exhaustive.of(1, 2, 3)
Exhaustive.Companion.of
Using AI Code Generation
1val exhaustiveInt = Exhaustive.of(1,2,3)2val exhaustiveString = Exhaustive.of("A","B","C")3val exhaustiveBoolean = Exhaustive.of(true,false)4val exhaustiveChar = Exhaustive.of('A','B','C')5val exhaustiveDouble = Exhaustive.of(1.0,2.0,3.0)6val exhaustiveFloat = Exhaustive.of(1.0f,2.0f,3.0f)7val exhaustiveByte = Exhaustive.of(1.toByte(),2.toByte(),3.toByte())8val exhaustiveShort = Exhaustive.of(1.toShort(),2.toShort(),3.toShort())9val exhaustiveLong = Exhaustive.of(1L,2L,3L)10val exhaustiveBigInteger = Exhaustive.of(BigInteger.ONE,BigInteger.TEN,BigInteger.valueOf(100))11val exhaustiveBigDecimal = Exhaustive.of(BigDecimal.ONE,BigDecimal.TEN,BigDecimal.valueOf(100))
Exhaustive.Companion.of
Using AI Code Generation
1val data = listOf ( 1 , 2 , 3 , 4 , 5 )2val exhaustive = Exhaustive . of (data)3exhaustive . values . shouldContainAll (data)4val data = listOf ( 1 , 2 , 3 , 4 , 5 )5val exhaustive = Exhaustive . of (data)6exhaustive . values . shouldContainAll (data)7val data = listOf ( 1 , 2 , 3 , 4 , 5 )8val exhaustive = Exhaustive . of (data)9exhaustive . values . shouldContainAll (data)10val data = listOf ( 1 , 2 , 3 , 4 , 5 )11val exhaustive = Exhaustive . of (data)12exhaustive . values . shouldContainAll (data)13val data = listOf ( 1 , 2 , 3 , 4 , 5 )14val exhaustive = Exhaustive . of (data)15exhaustive . values . shouldContainAll (data)16val data = listOf ( 1 , 2 , 3 , 4 , 5 )17val exhaustive = Exhaustive . of (data)18exhaustive . values . shouldContainAll (data)
Exhaustive.Companion.of
Using AI Code Generation
1val result = Exhaustive . of ( 1 to 2 , 3 to 4 , 5 to 6 ) 2 println ( result . values ) 3val result = Exhaustive . of ( Triple ( 1 , 2 , 3 ), Triple ( 4 , 5 , 6 )) 4 println ( result . values ) 5val result = Exhaustive . of ( listOf ( 1 , 2 , 3 ), listOf ( 4 , 5 , 6 )) 6 println ( result . values ) 7val result = Exhaustive . of ( setOf ( 1 , 2 , 3 ), setOf ( 4 , 5 , 6 )) 8 println ( result . values ) 9val result = Exhaustive . of ( mapOf ( 1 to 2 , 3 to 4 , 5 to 6 ), mapOf ( 7 to 8 , 9 to 10 , 11 to 12 )) 10 println ( result . values )
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!