How to use Arb.Companion.float method of io.kotest.property.arbitrary.floats class

Best Kotest code snippet using io.kotest.property.arbitrary.floats.Arb.Companion.float

FzyFloatEqualityTest.kt

Source:FzyFloatEqualityTest.kt Github

copy

Full Screen

1package com.xrpn.order.fuzzy2import io.kotest.core.spec.style.FunSpec3import io.kotest.matchers.shouldBe4import io.kotest.property.Arb5import io.kotest.property.checkAll6import com.xrpn.order.fuzzy.FzyFloat.Companion.fzyEqual7import com.xrpn.order.fuzzy.FzyFloat.Companion.fzyIsZero8import com.xrpn.order.fuzzy.FzyFloat.Companion.asFzyFloat9import com.xrpn.order.fuzzy.FzyFloat.Companion.fzyIsUnity10import io.kotest.assertions.throwables.shouldThrow11import io.kotest.property.arbitrary.float12import io.kotest.property.arbitrary.numericFloats13class FzyFloatEqualityTest : FunSpec({14 beforeTest {15 }16 test("pathology") {17 Float.NaN.fzyEqual(1.0f) shouldBe false18 Float.NaN.fzyEqual(Float.NaN) shouldBe false19 Float.NaN.asFzyFloat().isZero() shouldBe false20 Float.POSITIVE_INFINITY.fzyEqual(Float.POSITIVE_INFINITY) shouldBe true21 Float.NEGATIVE_INFINITY.fzyEqual(Float.POSITIVE_INFINITY) shouldBe false22 Float.POSITIVE_INFINITY.fzyEqual(Float.NEGATIVE_INFINITY) shouldBe false23 Float.NEGATIVE_INFINITY.fzyEqual(Float.NEGATIVE_INFINITY) shouldBe true24 FzyFloat(Float.NaN).equals(Float.NaN) shouldBe false25 (FzyFloat(Float.NaN) == FzyFloat(Float.NaN)) shouldBe false26 FzyFloat(Float.POSITIVE_INFINITY).equals(Float.POSITIVE_INFINITY) shouldBe true27 FzyFloat(Float.NEGATIVE_INFINITY).equals(Float.POSITIVE_INFINITY) shouldBe false28 FzyFloat(Float.POSITIVE_INFINITY).equals(Float.NEGATIVE_INFINITY) shouldBe false29 FzyFloat(Float.NEGATIVE_INFINITY).equals(Float.NEGATIVE_INFINITY) shouldBe true30 Float.MAX_VALUE.fzyEqual(Float.MAX_VALUE) shouldBe true31 }32 test("zeroes") {33 val ff0 = FzyFloat(0.0f)34 val ff1 = FzyFloat(Float.MIN_VALUE)35 val ff2 = FzyFloat(-Float.MIN_VALUE)36 val ff3 = FzyFloat(1.0f)37 ff0.isZero() shouldBe true38 ff1.isZero() shouldBe true39 ff2.isZero() shouldBe true40 ff3.isZero() shouldBe false41 Float.MIN_VALUE.fzyIsZero() shouldBe true42 0.0f.fzyIsZero() shouldBe true43 (-Float.MIN_VALUE).fzyIsZero() shouldBe true44 1.0f.fzyIsZero() shouldBe false45 Float.NaN.fzyIsZero() shouldBe false46 Float.POSITIVE_INFINITY.fzyIsZero() shouldBe false47 Float.NEGATIVE_INFINITY.fzyIsZero() shouldBe false48 }49 test("unity") {50 val fd0 = FzyFloat(1.0f)51 val fd00 = FzyFloat(1.0f, floatEps, true)52 val fd1 = FzyFloat(1.0f+defaultFloatTol)53 val fd2 = FzyFloat(1.0f-defaultFloatTol)54 val fd3 = FzyFloat(1.0f+defaultFloatTol, 2.0f*defaultFloatTol)55 val fd4 = FzyFloat(1.0f-defaultFloatTol, 2.0f*defaultFloatTol)56 fd0.isUnity() shouldBe true57 fd00.isUnity() shouldBe true58 fd1.isUnity() shouldBe false59 fd2.isUnity() shouldBe false60 fd3.isUnity() shouldBe true61 fd4.isUnity() shouldBe true62 1.0f.fzyIsUnity() shouldBe true63 (1.0f+defaultFloatTol).fzyIsUnity() shouldBe false64 (1.0f-defaultFloatTol).fzyIsUnity() shouldBe false65 Float.NaN.fzyIsUnity() shouldBe false66 Float.NEGATIVE_INFINITY.fzyIsUnity() shouldBe false67 Float.POSITIVE_INFINITY.fzyIsUnity() shouldBe false68 }69 test("throw if defeated"){70 shouldThrow<IllegalArgumentException> {71 FzyFloat(1.0f, floatEps)72 }73 shouldThrow<IllegalArgumentException> {74 FzyFloat(1.0f, -0.0004f)75 }76 }77 test("bounds") {78 (FzyFloat(Float.MAX_VALUE) == FzyFloat(Float.MAX_VALUE)) shouldBe true79 (FzyFloat(-Float.MAX_VALUE) == FzyFloat(-Float.MAX_VALUE)) shouldBe true80 FzyFloat(Float.MAX_VALUE).equals(Float.MAX_VALUE) shouldBe true81 FzyFloat(-Float.MAX_VALUE).equals(-Float.MAX_VALUE) shouldBe true82 (FzyFloat(Float.MIN_VALUE) == FzyFloat(Float.MIN_VALUE)) shouldBe true83 (FzyFloat(Float.MIN_VALUE) == FzyFloat(-Float.MIN_VALUE)) shouldBe true84 (FzyFloat(-Float.MIN_VALUE) == FzyFloat(-Float.MIN_VALUE)) shouldBe true85 FzyFloat(Float.MIN_VALUE).equals(Float.MIN_VALUE) shouldBe true86 FzyFloat(Float.MIN_VALUE).equals(-Float.MIN_VALUE) shouldBe true87 FzyFloat(-Float.MIN_VALUE).equals(-Float.MIN_VALUE) shouldBe true88 Float.MAX_VALUE.fzyEqual(Float.MAX_VALUE) shouldBe true89 (-Float.MAX_VALUE).fzyEqual(-Float.MAX_VALUE) shouldBe true90 Float.MAX_VALUE.fzyEqual(FzyFloat(Float.MAX_VALUE)) shouldBe true91 (-Float.MAX_VALUE).fzyEqual(FzyFloat(-Float.MAX_VALUE)) shouldBe true92 Float.MIN_VALUE.fzyEqual(Float.MIN_VALUE) shouldBe true93 Float.MIN_VALUE.fzyEqual(-Float.MIN_VALUE) shouldBe true94 (-Float.MIN_VALUE).fzyEqual(-Float.MIN_VALUE) shouldBe true95 Float.MIN_VALUE.fzyEqual(FzyFloat(Float.MIN_VALUE)) shouldBe true96 Float.MIN_VALUE.fzyEqual(FzyFloat(-Float.MIN_VALUE)) shouldBe true97 (-Float.MIN_VALUE).fzyEqual(FzyFloat(-Float.MIN_VALUE)) shouldBe true98 }99 test("underflow") {100 (FzyFloat(Float.MAX_VALUE) == FzyFloat(1E-10f)) shouldBe false101 (FzyFloat(-Float.MAX_VALUE) == FzyFloat(-1E-10f)) shouldBe false102 FzyFloat(Float.MAX_VALUE).equals(1E-10f) shouldBe false103 FzyFloat(-Float.MAX_VALUE).equals(-1E-10f) shouldBe false104 }105 test("overflow") {106 (FzyFloat(1E-10f) == FzyFloat(Float.MAX_VALUE)) shouldBe false107 (FzyFloat(-1E-10f) == FzyFloat(-Float.MAX_VALUE)) shouldBe false108 FzyFloat(1E-10f).equals(Float.MAX_VALUE) shouldBe false109 FzyFloat(-1E-10f).equals(-Float.MAX_VALUE) shouldBe false110 }111 test("same zeroes") {112 val fd0a = FzyFloat.zero()113 val fd0b = FzyFloat.zero()114 val fd00 = FzyFloat.zero(defaultFloatTol*2.0f)115 val fd1 = FzyFloat.unity()116 FzyFloatEquality.isSameZeroes(fd0a, fd0a) shouldBe true117 FzyFloatEquality.isSameZeroes(fd0a, fd0b) shouldBe true118 FzyFloatEquality.isSameZeroes(fd0b, fd0a) shouldBe true119 FzyFloatEquality.isSameZeroes(fd0a, fd00) shouldBe false120 FzyFloatEquality.isSameZeroes(fd00, fd0a) shouldBe false121 FzyFloatEquality.isSameZeroes(fd0a, fd1) shouldBe false122 FzyFloatEquality.isSameZeroes(fd1, fd0a) shouldBe false123 }124 test("float properties, reflexive") {125 checkAll(Arb.float(), Arb.numericFloats()) { f1, f2 ->126 val ff1a = FzyFloat(f1)127 val ff1b = FzyFloat(f1)128 val ff2a = FzyFloat(f2)129 val ff2b = FzyFloat(f2)130 ff1a.equals(f1) shouldBe !f1.isNaN()131 ff1b.equals(f1) shouldBe !f1.isNaN()132 ff2a.equals(f2) shouldBe true133 ff2b.equals(f2) shouldBe true134 f1.fzyEqual(f1) shouldBe !f1.isNaN()135 f1.fzyEqual(ff1a) shouldBe !f1.isNaN()136 f1.fzyEqual(ff1b) shouldBe !f1.isNaN()137 ff1a.equals(f1) shouldBe !f1.isNaN()138 ff1b.equals(f1) shouldBe !f1.isNaN()139 (ff1a == ff1b) shouldBe !f1.isNaN()140 (ff1b == ff1a) shouldBe !f1.isNaN()141 ff2a.equals(f2) shouldBe true142 ff2b.equals(f2) shouldBe true143 (ff2a == ff2b) shouldBe true144 (ff2b == ff2a) shouldBe true145 }146 }147 test("float properties, symmetric") {148 checkAll(Arb.float(), Arb.numericFloats()) { f1, f2 ->149 val ff1 = FzyFloat(f1)150 val f1d = ff1.qty / (1.0f + (defaultFloatTol /2.0f))151 val ff1d = FzyFloat(f1d)152 val ff2 = FzyFloat(f2)153 val f2d = ff2.qty / (1.0f + (defaultFloatTol /2.0f))154 val ff2d = FzyFloat(f2d)155 (!ff1.equals(f1d) && f1.fzyIsZero()) shouldBe false156 (f1.fzyIsZero() && ff1 != ff1d) shouldBe false157 f1.fzyEqual(f1d) shouldBe !f1.isNaN()158 f1.fzyEqual(ff1d) shouldBe !f1.isNaN()159 f1d.fzyEqual(f1) shouldBe !f1.isNaN()160 f1d.fzyEqual(ff1) shouldBe !f1.isNaN()161 ff1.equals(f1d) shouldBe !f1.isNaN()162 (ff1d == ff1) shouldBe !f1.isNaN()163 ff1d.equals(f1) shouldBe !f1.isNaN()164 ff1.equals(f1d) shouldBe !f1.isNaN()165 (!ff2.equals(f2d) && f2.fzyIsZero()) shouldBe false166 (f2.fzyIsZero() && ff2 != ff2d) shouldBe false167 f2.fzyEqual(f2d) shouldBe true168 f2.fzyEqual(ff2d) shouldBe true169 f2d.fzyEqual(f2) shouldBe true170 f2d.fzyEqual(ff2) shouldBe true171 ff2.equals(f2d) shouldBe true172 (ff2d == ff2) shouldBe true173 ff2d.equals(f2) shouldBe true174 ff2.equals(f2d) shouldBe true175 }176 }177 test("float properties, transitive") {178 checkAll(Arb.float(), Arb.numericFloats()) { f1, f2 ->179 val ff1 = FzyFloat(f1)180 val f1a = f1 / (1.0f + (defaultFloatTol /1.7f))181 val ff1a = FzyFloat(f1a)182 val f1b = f1 / (1.0f + (defaultFloatTol /1.3f))183 val ff1b = FzyFloat(f1b)184 val ff2 = FzyFloat(f2)185 val f2a = f2 / (1.0f + (defaultFloatTol /1.9f))186 val ff2a = FzyFloat(f2a)187 val f2b = f2 / (1.0f + (defaultFloatTol /1.5f))188 val ff2b = FzyFloat(f2b)189 (!ff1.equals(f1a) && f1.fzyIsZero()) shouldBe false190 (f1.fzyIsZero() && ff1 != ff1a) shouldBe false191 (!ff1.equals(f1b) && f1.fzyIsZero()) shouldBe false192 (f1.fzyIsZero() && ff1 != ff1b) shouldBe false193 // f1 == f1a, f1a == f1b => f1 == f1b194 f1.fzyEqual(f1a) shouldBe !f1.isNaN()195 f1.fzyEqual(ff1a) shouldBe !f1.isNaN()196 f1a.fzyEqual(f1b) shouldBe !f1.isNaN()197 f1a.fzyEqual(ff1b) shouldBe !f1.isNaN()198 f1b.fzyEqual(f1) shouldBe !f1.isNaN()199 f1b.fzyEqual(ff1) shouldBe !f1.isNaN()200 ff1.equals(f1a) shouldBe !f1.isNaN()201 (ff1 == ff1a) shouldBe !f1.isNaN()202 ff1a.equals(f1b) shouldBe !f1.isNaN()203 (ff1a == ff1b) shouldBe !f1.isNaN()204 ff1b.equals(f1) shouldBe !f1.isNaN()205 (ff1b == ff1) shouldBe !f1.isNaN()206 (!ff2.equals(f2a) && f2.fzyIsZero()) shouldBe false207 (f2.fzyIsZero() && ff2 != ff2a) shouldBe false208 (!ff2.equals(f2b) && f2.fzyIsZero()) shouldBe false209 (f2.fzyIsZero() && ff2 != ff2b) shouldBe false210 // f2 == f2a, f2a == f2b => f2 == f2b211 f2.fzyEqual(f2a) shouldBe true212 f2.fzyEqual(ff2a) shouldBe true213 f2a.fzyEqual(f2b) shouldBe true214 f2a.fzyEqual(ff2b) shouldBe true215 f2b.fzyEqual(f2) shouldBe true216 f2b.fzyEqual(ff2) shouldBe true217 ff2.equals(f2a) shouldBe true218 (ff2 == ff2a) shouldBe true219 ff2a.equals(f2b) shouldBe true220 (ff2a == ff2b) shouldBe true221 ff2b.equals(f2) shouldBe true222 (ff2b == ff2) shouldBe true223 }224 }225})...

Full Screen

Full Screen

Arb.kt

Source:Arb.kt Github

copy

Full Screen

1package arrow.fx.coroutines.stream2import io.kotest.property.Arb3import io.kotest.property.RandomSource4import io.kotest.property.Sample5import io.kotest.property.Shrinker6import io.kotest.property.arbitrary.arb7import io.kotest.property.arbitrary.bool8import io.kotest.property.arbitrary.byte9import io.kotest.property.arbitrary.choice10import io.kotest.property.arbitrary.choose11import io.kotest.property.arbitrary.double12import io.kotest.property.arbitrary.float13import io.kotest.property.arbitrary.int14import io.kotest.property.arbitrary.list15import io.kotest.property.arbitrary.long16import io.kotest.property.arbitrary.map17import io.kotest.property.arbitrary.set18import io.kotest.property.arbitrary.short19import kotlin.random.nextInt20@JvmOverloads21inline fun <reified A> Arb.Companion.array(22 gen: Arb<A>,23 range: IntRange = 0..10024): Arb<Array<A>> {25 check(!range.isEmpty())26 check(range.first >= 0)27 return arb(edgecases = listOf(emptyArray<A>()) + gen.edgecases().map { arrayOf(it) }) {28 sequence {29 val genIter = gen.generate(it).iterator()30 while (true) {31 val targetSize = it.random.nextInt(range)32 val list = ArrayList<A>(targetSize)33 while (list.size < targetSize && genIter.hasNext()) {34 list.add(genIter.next().value)35 }36 check(list.size == targetSize)37 yield(list.toArray() as Array<A>)38 }39 }40 }41}42@PublishedApi43internal fun <A, B> arrayChunkGenerator(44 arb: Arb<A>,45 shrinker: Shrinker<B>,46 range: IntRange = 0..10,47 build: (values: List<A>, offset: Int, length: Int) -> B48): Arb<B> {49 check(!range.isEmpty())50 check(range.first >= 0)51 val edgecases =52 arb.edgecases().map { a -> build(listOf(a), 0, 1) } + build(emptyList(), 0, 0)53 return arb(edgecases, shrinker) {54 val genIter = arb.generate(it).iterator()55 sequence {56 while (true) {57 val targetSize = it.random.nextInt(range)58 val list = ArrayList<A>(targetSize)59 while (list.size < targetSize && genIter.hasNext()) {60 list.add(genIter.next().value)61 }62 val offset = (0..list.size).random(it.random)63 val length = (0..(list.size - offset)).random(it.random)64 yield(build(list, offset, length))65 }66 }67 }68}69class ChunkShrinker<A> : Shrinker<Chunk<A>> {70 override fun shrink(value: Chunk<A>): List<Chunk<A>> =71 if (value.isEmpty()) emptyList()72 else listOf(73 Chunk.empty(),74 value.takeLast(1),75 value.take(value.size() / 3),76 value.take(value.size() / 2),77 value.take(value.size() * 2 / 3),78 value.dropLast(1)79 )80}81inline fun <reified A> Arb.Companion.chunk(arb: Arb<A>): Arb<Chunk<A>> =82 object : Arb<Chunk<A>>() {83 override fun edgecases(): List<Chunk<A>> =84 listOf(Chunk.empty<A>()) + arb.edgecases().map { Chunk(it) }85 override fun values(rs: RandomSource): Sequence<Sample<Chunk<A>>> =86 Arb.choose(87 5 to arb.map { Chunk.just(it) },88 10 to Arb.list(arb, 0..20).map { Chunk.iterable(it) },89 10 to Arb.set(arb, 0..20).map { Chunk.iterable(it) },90 10 to Arb.array(arb, 0..20).map { Chunk.array(it) },91 10 to Arb.boxedChunk(arb)92 ).values(rs)93 }94inline fun <reified A> Arb.Companion.boxedChunk(arb: Arb<A>): Arb<Chunk<A>> =95 object : Arb<Chunk<A>>() {96 override fun edgecases(): List<Chunk<A>> =97 listOf(Chunk.empty<A>()) + arb.edgecases().map { Chunk(it) }98 override fun values(rs: RandomSource): Sequence<Sample<Chunk<A>>> =99 arrayChunkGenerator(arb, ChunkShrinker()) { values, offset, length ->100 Chunk.boxed(values.toTypedArray(), offset, length)101 }.values(rs)102 }103fun Arb.Companion.booleanChunk(): Arb<Chunk<Boolean>> =104 object : Arb<Chunk<Boolean>>() {105 override fun edgecases(): List<Chunk<Boolean>> =106 listOf(Chunk.empty<Boolean>()) + Arb.bool().edgecases().map { Chunk(it) }107 override fun values(rs: RandomSource): Sequence<Sample<Chunk<Boolean>>> =108 Arb.choice(109 arrayChunkGenerator(Arb.bool(), ChunkShrinker()) { values, offset, length ->110 Chunk.booleans(values.toBooleanArray(), offset, length)111 },112 arrayChunkGenerator(Arb.bool(), ChunkShrinker()) { values, _, _ ->113 Chunk.array(values.toTypedArray())114 }115 ).values(rs)116 }117fun Arb.Companion.byteChunk(): Arb<Chunk<Byte>> =118 object : Arb<Chunk<Byte>>() {119 override fun edgecases(): List<Chunk<Byte>> =120 listOf(Chunk.empty<Byte>()) + Arb.byte().edgecases().map { Chunk(it) }121 override fun values(rs: RandomSource): Sequence<Sample<Chunk<Byte>>> =122 Arb.choice(123 arrayChunkGenerator(Arb.byte(), ChunkShrinker()) { values, offset, length ->124 Chunk.bytes(values.toByteArray(), offset, length)125 },126 arrayChunkGenerator(Arb.byte(), ChunkShrinker()) { values, _, _ ->127 Chunk.array(values.toTypedArray())128 }129 ).values(rs)130 }131fun Arb.Companion.intChunk(): Arb<Chunk<Int>> =132 object : Arb<Chunk<Int>>() {133 override fun edgecases(): List<Chunk<Int>> =134 listOf(Chunk.empty<Int>()) + Arb.int().edgecases().map { Chunk(it) }135 override fun values(rs: RandomSource): Sequence<Sample<Chunk<Int>>> =136 Arb.choice(137 arrayChunkGenerator(Arb.int(), ChunkShrinker()) { values, offset, length ->138 Chunk.ints(values.toIntArray(), offset, length)139 },140 arrayChunkGenerator(Arb.int(), ChunkShrinker()) { values, _, _ ->141 Chunk.array(values.toTypedArray())142 }143 ).values(rs)144 }145fun Arb.Companion.longChunk(): Arb<Chunk<Long>> =146 object : Arb<Chunk<Long>>() {147 override fun edgecases(): List<Chunk<Long>> =148 listOf(Chunk.empty<Long>()) + Arb.long().edgecases().map { Chunk(it) }149 override fun values(rs: RandomSource): Sequence<Sample<Chunk<Long>>> =150 Arb.choice(151 arrayChunkGenerator(Arb.long(), ChunkShrinker()) { values, offset, length ->152 Chunk.longs(values.toLongArray(), offset, length)153 },154 arrayChunkGenerator(Arb.long(), ChunkShrinker()) { values, _, _ ->155 Chunk.array(values.toTypedArray())156 }157 ).values(rs)158 }159fun Arb.Companion.doubleChunk(): Arb<Chunk<Double>> =160 object : Arb<Chunk<Double>>() {161 override fun edgecases(): List<Chunk<Double>> =162 listOf(Chunk.empty<Double>()) + Arb.double().edgecases().map { Chunk(it) }163 override fun values(rs: RandomSource): Sequence<Sample<Chunk<Double>>> =164 Arb.choice(165 arrayChunkGenerator(Arb.double(), ChunkShrinker()) { values, offset, length ->166 Chunk.doubles(values.toDoubleArray(), offset, length)167 },168 arrayChunkGenerator(Arb.double(), ChunkShrinker()) { values, _, _ ->169 Chunk.array(values.toTypedArray())170 }171 ).values(rs)172 }173fun Arb.Companion.floatChunk(): Arb<Chunk<Float>> =174 object : Arb<Chunk<Float>>() {175 override fun edgecases(): List<Chunk<Float>> =176 listOf(Chunk.empty<Float>()) + Arb.float().edgecases().map { Chunk(it) }177 override fun values(rs: RandomSource): Sequence<Sample<Chunk<Float>>> =178 Arb.choice(179 arrayChunkGenerator(Arb.float(), ChunkShrinker()) { values, offset, length ->180 Chunk.floats(values.toFloatArray(), offset, length)181 },182 arrayChunkGenerator(Arb.float(), ChunkShrinker()) { values, _, _ ->183 Chunk.array(values.toTypedArray())184 }185 ).values(rs)186 }187fun Arb.Companion.shortChunk(): Arb<Chunk<Short>> =188 object : Arb<Chunk<Short>>() {189 override fun edgecases(): List<Chunk<Short>> =190 listOf(Chunk.empty<Short>()) + Arb.short().edgecases().map { Chunk(it) }191 override fun values(rs: RandomSource): Sequence<Sample<Chunk<Short>>> =192 Arb.choice(193 arrayChunkGenerator(Arb.short(), ChunkShrinker()) { values, offset, length ->194 Chunk.shorts(values.toShortArray(), offset, length)195 },196 arrayChunkGenerator(Arb.short(), ChunkShrinker()) { values, _, _ ->197 Chunk.array(values.toTypedArray())198 }199 ).values(rs)200 }...

Full Screen

Full Screen

Generators.kt

Source:Generators.kt Github

copy

Full Screen

1package arrow.core.test.generators2import arrow.core.Const3import arrow.core.Either4import arrow.core.Endo5import arrow.core.Eval6import arrow.core.Ior7import arrow.core.Option8import arrow.core.Tuple109import arrow.core.Tuple410import arrow.core.Tuple511import arrow.core.Tuple612import arrow.core.Tuple713import arrow.core.Tuple814import arrow.core.Tuple915import arrow.core.Validated16import arrow.core.left17import arrow.core.right18import arrow.core.toOption19import io.kotest.property.Arb20import io.kotest.property.arbitrary.bind21import io.kotest.property.arbitrary.boolean22import io.kotest.property.arbitrary.byte23import io.kotest.property.arbitrary.choice24import io.kotest.property.arbitrary.constant25import io.kotest.property.arbitrary.filter26import io.kotest.property.arbitrary.flatMap27import io.kotest.property.arbitrary.int28import io.kotest.property.arbitrary.long29import io.kotest.property.arbitrary.map30import io.kotest.property.arbitrary.numericDoubles31import io.kotest.property.arbitrary.numericFloats32import io.kotest.property.arbitrary.of33import io.kotest.property.arbitrary.orNull34import io.kotest.property.arbitrary.short35import io.kotest.property.arbitrary.string36import kotlin.Result.Companion.failure37import kotlin.Result.Companion.success38import kotlin.math.abs39public fun <A, B> Arb.Companion.functionAToB(arb: Arb<B>): Arb<(A) -> B> =40 arb.map { b: B -> { _: A -> b } }41public fun <A> Arb.Companion.functionAAToA(arb: Arb<A>): Arb<(A, A) -> A> =42 arb.map { a: A -> { _: A, _: A -> a } }43public fun <A, B> Arb.Companion.functionBAToB(arb: Arb<B>): Arb<(B, A) -> B> =44 arb.map { b: B -> { _: B, _: A -> b } }45public fun <A, B> Arb.Companion.functionABToB(arb: Arb<B>): Arb<(A, B) -> B> =46 arb.map { b: B -> { _: A, _: B -> b } }47public fun <A> Arb.Companion.functionToA(arb: Arb<A>): Arb<() -> A> =48 arb.map { a: A -> { a } }49public fun Arb.Companion.throwable(): Arb<Throwable> =50 Arb.of(listOf(RuntimeException(), NoSuchElementException(), IllegalArgumentException()))51public fun <A> Arb.Companion.result(arbA: Arb<A>): Arb<Result<A>> =52 Arb.choice(arbA.map(::success), throwable().map(::failure))53public fun Arb.Companion.doubleSmall(): Arb<Double> =54 Arb.numericDoubles(from = 0.0, to = 100.0)55public fun Arb.Companion.floatSmall(): Arb<Float> =56 Arb.numericFloats(from = 0F, to = 100F)57public fun Arb.Companion.intSmall(factor: Int = 10000): Arb<Int> =58 Arb.int((Int.MIN_VALUE / factor)..(Int.MAX_VALUE / factor))59public fun Arb.Companion.byteSmall(): Arb<Byte> =60 Arb.byte(min = (Byte.MIN_VALUE / 10).toByte(), max = (Byte.MAX_VALUE / 10).toByte())61public fun Arb.Companion.shortSmall(): Arb<Short> {62 val range = (Short.MIN_VALUE / 1000)..(Short.MAX_VALUE / 1000)63 return Arb.short().filter { it in range }64}65public fun Arb.Companion.longSmall(): Arb<Long> =66 Arb.long((Long.MIN_VALUE / 100000L)..(Long.MAX_VALUE / 100000L))67public fun <A, B, C, D> Arb.Companion.tuple4(arbA: Arb<A>, arbB: Arb<B>, arbC: Arb<C>, arbD: Arb<D>): Arb<Tuple4<A, B, C, D>> =68 Arb.bind(arbA, arbB, arbC, arbD, ::Tuple4)69public fun <A, B, C, D, E> Arb.Companion.tuple5(70 arbA: Arb<A>,71 arbB: Arb<B>,72 arbC: Arb<C>,73 arbD: Arb<D>,74 arbE: Arb<E>75): Arb<Tuple5<A, B, C, D, E>> =76 Arb.bind(arbA, arbB, arbC, arbD, arbE, ::Tuple5)77public fun <A, B, C, D, E, F> Arb.Companion.tuple6(78 arbA: Arb<A>,79 arbB: Arb<B>,80 arbC: Arb<C>,81 arbD: Arb<D>,82 arbE: Arb<E>,83 arbF: Arb<F>84): Arb<Tuple6<A, B, C, D, E, F>> =85 Arb.bind(arbA, arbB, arbC, arbD, arbE, arbF, ::Tuple6)86public fun <A, B, C, D, E, F, G> Arb.Companion.tuple7(87 arbA: Arb<A>,88 arbB: Arb<B>,89 arbC: Arb<C>,90 arbD: Arb<D>,91 arbE: Arb<E>,92 arbF: Arb<F>,93 arbG: Arb<G>94): Arb<Tuple7<A, B, C, D, E, F, G>> =95 Arb.bind(arbA, arbB, arbC, arbD, arbE, arbF, arbG, ::Tuple7)96public fun <A, B, C, D, E, F, G, H> Arb.Companion.tuple8(97 arbA: Arb<A>,98 arbB: Arb<B>,99 arbC: Arb<C>,100 arbD: Arb<D>,101 arbE: Arb<E>,102 arbF: Arb<F>,103 arbG: Arb<G>,104 arbH: Arb<H>105): Arb<Tuple8<A, B, C, D, E, F, G, H>> =106 Arb.bind(107 Arb.tuple7(arbA, arbB, arbC, arbD, arbE, arbF, arbG),108 arbH109 ) { (a, b, c, d, e, f, g), h ->110 Tuple8(a, b, c, d, e, f, g, h)111 }112public fun <A, B, C, D, E, F, G, H, I> Arb.Companion.tuple9(113 arbA: Arb<A>,114 arbB: Arb<B>,115 arbC: Arb<C>,116 arbD: Arb<D>,117 arbE: Arb<E>,118 arbF: Arb<F>,119 arbG: Arb<G>,120 arbH: Arb<H>,121 arbI: Arb<I>122): Arb<Tuple9<A, B, C, D, E, F, G, H, I>> =123 Arb.bind(124 Arb.tuple8(arbA, arbB, arbC, arbD, arbE, arbF, arbG, arbH),125 arbI126 ) { (a, b, c, d, e, f, g, h), i ->127 Tuple9(a, b, c, d, e, f, g, h, i)128 }129public fun <A, B, C, D, E, F, G, H, I, J> Arb.Companion.tuple10(130 arbA: Arb<A>,131 arbB: Arb<B>,132 arbC: Arb<C>,133 arbD: Arb<D>,134 arbE: Arb<E>,135 arbF: Arb<F>,136 arbG: Arb<G>,137 arbH: Arb<H>,138 arbI: Arb<I>,139 arbJ: Arb<J>140): Arb<Tuple10<A, B, C, D, E, F, G, H, I, J>> =141 Arb.bind(142 Arb.tuple9(arbA, arbB, arbC, arbD, arbE, arbF, arbG, arbH, arbI),143 arbJ144 ) { (a, b, c, d, e, f, g, h, i), j ->145 Tuple10(a, b, c, d, e, f, g, h, i, j)146 }147public fun Arb.Companion.nonZeroInt(): Arb<Int> = Arb.int().filter { it != 0 }148public fun Arb.Companion.intPredicate(): Arb<(Int) -> Boolean> =149 Arb.nonZeroInt().flatMap { num ->150 val absNum = abs(num)151 Arb.of(152 listOf<(Int) -> Boolean>(153 { it > num },154 { it <= num },155 { it % absNum == 0 },156 { it % absNum == absNum - 1 }157 )158 )159 }160public fun <A> Arb.Companion.endo(arb: Arb<A>): Arb<Endo<A>> = arb.map { a: A -> Endo<A> { a } }161public fun <B> Arb.Companion.option(arb: Arb<B>): Arb<Option<B>> =162 arb.orNull().map { it.toOption() }163public fun <E, A> Arb.Companion.either(arbE: Arb<E>, arbA: Arb<A>): Arb<Either<E, A>> {164 val arbLeft = arbE.map { Either.Left(it) }165 val arbRight = arbA.map { Either.Right(it) }166 return Arb.choice(arbLeft, arbRight)167}168public fun <E, A> Arb<E>.or(arbA: Arb<A>): Arb<Either<E, A>> = Arb.either(this, arbA)169public fun <E, A> Arb.Companion.validated(arbE: Arb<E>, arbA: Arb<A>): Arb<Validated<E, A>> =170 Arb.either(arbE, arbA).map { Validated.fromEither(it) }171public fun Arb.Companion.unit(): Arb<Unit> =172 Arb.constant(Unit)173public fun <A, B> Arb.Companion.ior(arbA: Arb<A>, arbB: Arb<B>): Arb<Ior<A, B>> =174 arbA.alignWith(arbB) { it }175public fun <A, B> Arb.Companion.arbConst(arb: Arb<A>): Arb<Const<A, B>> =176 arb.map { Const<A, B>(it) }177public fun <A> Arb<A>.eval(): Arb<Eval<A>> =178 map { Eval.now(it) }179private fun <A, B, R> Arb<A>.alignWith(arbB: Arb<B>, transform: (Ior<A, B>) -> R): Arb<R> =180 Arb.bind(this, arbB) { a, b -> transform(Ior.Both(a, b)) }181public fun Arb.Companion.suspendFunThatReturnsEitherAnyOrAnyOrThrows(): Arb<suspend () -> Either<Any, Any>> =182 choice(183 suspendFunThatReturnsAnyRight(),184 suspendFunThatReturnsAnyLeft(),185 suspendFunThatThrows()186 )187public fun Arb.Companion.suspendFunThatReturnsAnyRight(): Arb<suspend () -> Either<Any, Any>> =188 any().map { suspend { it.right() } }189public fun Arb.Companion.suspendFunThatReturnsAnyLeft(): Arb<suspend () -> Either<Any, Any>> =190 any().map { suspend { it.left() } }191public fun Arb.Companion.suspendFunThatThrows(): Arb<suspend () -> Either<Any, Any>> =192 throwable().map { suspend { throw it } } as Arb<suspend () -> Either<Any, Any>>193public fun Arb.Companion.any(): Arb<Any> =194 choice(195 Arb.string() as Arb<Any>,196 Arb.int() as Arb<Any>,197 Arb.long() as Arb<Any>,198 Arb.boolean() as Arb<Any>,199 Arb.throwable() as Arb<Any>,200 Arb.unit() as Arb<Any>201 )...

Full Screen

Full Screen

FzyFloatTest.kt

Source:FzyFloatTest.kt Github

copy

Full Screen

1package com.xrpn.order.fuzzy2import com.xrpn.order.fuzzy.FzyFloat.Companion.asFzyFloat3import com.xrpn.order.fuzzy.FzyFloat.Companion.fzyEqual4import com.xrpn.order.fuzzy.FzyFloat.Companion.unity5import com.xrpn.order.fuzzy.FzyFloat.Companion.zero6import com.xrpn.order.fuzzy.FzyFloatEquality.fzyEqual7import io.kotest.core.spec.style.FunSpec8import io.kotest.matchers.shouldBe9import io.kotest.property.*10import io.kotest.property.arbitrary.arbitrary11import io.kotest.property.arbitrary.float12import io.kotest.property.arbitrary.numericFloats13class FzyFloatTest : FunSpec({14 val alterFloatTol = 2.0f * defaultFloatTol15 val fzyFloatDefaultArb: Arb<FzyFloat> = arbitrary { rs: RandomSource ->16 FzyFloat(rs.random.nextFloat())17 }18 val fzyFloatAlterArb: Arb<FzyFloat> = arbitrary { rs: RandomSource ->19 FzyFloat(rs.random.nextFloat(), alterFloatTol)20 }21 beforeTest {}22 beforeEach {}23 test("equals default") {24 checkAll(fzyFloatDefaultArb) { fzf1 ->25 val tt = fzf1.tol26 val halfTt = fzf1.tol / 2.0f27 val twiceTt = fzf1.tol * 2.0f28 (fzf1 == fzf1) shouldBe true29 val aux0 = FzyFloat(fzf1.qty,fzf1.tol)30 (fzf1 == aux0) shouldBe true31 val aux1 = FzyFloat(fzf1.qty+fzf1.qty*halfTt)32 (fzf1.qty == aux1.qty) shouldBe false33 (fzf1 == aux1) shouldBe true34 (fzf1 == FzyFloat(fzf1.qty, twiceTt)) shouldBe false35 fzf1.equals(fzf1.qty) shouldBe true36 fzf1.equals(fzf1.qty+tt) shouldBe false37 fzf1.equals(fzf1.qty-tt) shouldBe false38 fzf1.equals(fzf1.qty.toDouble()) shouldBe false39 fzf1.equals(null) shouldBe false40 fzf1.equals("") shouldBe false41 }42 }43 test("equals alter") {44 checkAll(fzyFloatAlterArb) { fzfa1 ->45 val tt = fzfa1.tol46 val halfTt = fzfa1.tol / 2.0f47 val twiceTt = fzfa1.tol * 2.0f48 (fzfa1 == fzfa1) shouldBe true49 val aux0 = FzyFloat(fzfa1.qty,fzfa1.tol)50 (fzfa1 == aux0) shouldBe true51 val aux1 = FzyFloat(fzfa1.qty+fzfa1.qty*halfTt,alterFloatTol)52 (fzfa1.qty == aux1.qty) shouldBe false53 (fzfa1 == aux1) shouldBe true54 (fzfa1 == FzyFloat(fzfa1.qty, twiceTt)) shouldBe false55 fzfa1.equals(fzfa1.qty) shouldBe true56 fzfa1.equals(fzfa1.qty+tt) shouldBe false57 fzfa1.equals(fzfa1.qty-tt) shouldBe false58 fzfa1.equals(fzfa1.qty.toDouble()) shouldBe false59 fzfa1.equals(null) shouldBe false60 fzfa1.equals("") shouldBe false61 }62 }63 test("equals mixed") {64 checkAll(fzyFloatDefaultArb, fzyFloatAlterArb) { fzf1, fzfa1 ->65 (fzf1 == fzfa1) shouldBe false66 fzfa1.equals(fzfa1.qty) shouldBe true67 }68 }69 test("equal (zeroes)") {70 zero().equal(zero()) shouldBe true71 zero().equal(unity()) shouldBe false72 unity().equal(zero()) shouldBe false73 floatEps.fzyEqual(zero()) shouldBe true74 zero().equals(floatEps) shouldBe true75 }76 test("hashCode") {77 forAll<FzyFloat, FzyFloat>(PropTestConfig(iterations = 10),fzyFloatDefaultArb,fzyFloatDefaultArb) { fzf1, fzf2 ->78 fzf1.hashCode() == fzf1.hashCode()79 && fzf2.hashCode() == fzf2.hashCode()80 && fzf1.hashCode() != fzf2.hashCode()81 }82 }83 test("isZero") {84 FzyFloat.zero().isZero() shouldBe true85 FzyFloat.zero(alterFloatTol).isZero() shouldBe true86 }87 test("isUnity") {88 FzyFloat.unity().isUnity() shouldBe true89 FzyFloat.unity(alterFloatTol).isUnity() shouldBe true90 }91 test("Float.fzyEqual") {92 checkAll(Arb.numericFloats()) { nf1 ->93 val nf1fzy = nf1.asFzyFloat()94 nf1.fzyEqual(nf1fzy) shouldBe true95 nf1.fzyEqual(nf1.asFzyFloat(alterFloatTol)) shouldBe true96 nf1.fzyEqual(nf1, defaultFloatTol) shouldBe true97 nf1.fzyEqual(nf1, alterFloatTol) shouldBe true98 val tol = nf1fzy.tol99 val aux = if (nf1 == 0.0f) 1.0f + tol * 20.0f else nf1 + nf1 * tol * 20.0f100 val nf2 = if (nf1 != aux) aux else nf1 + 1.0f101 (nf1 != nf2) shouldBe true102 nf1.fzyEqual(nf2.asFzyFloat()) shouldBe false103 nf1.fzyEqual(nf2, defaultFloatTol) shouldBe false104 nf1.fzyEqual(nf2, alterFloatTol) shouldBe false105 }106 }107 test("Float.fzyEqual qty pathology") {108 checkAll(Arb.float()) { nf1 ->109 val nf1fzy = nf1.asFzyFloat()110 nf1.fzyEqual(nf1fzy) shouldBe !nf1.isNaN()111 nf1.fzyEqual(nf1.asFzyFloat(alterFloatTol)) shouldBe !nf1.isNaN()112 nf1.fzyEqual(nf1, defaultFloatTol) shouldBe !nf1.isNaN()113 nf1.fzyEqual(nf1, alterFloatTol) shouldBe !nf1.isNaN()114 nf1fzy.fzyEqual(nf1) shouldBe !nf1.isNaN()115 nf1fzy.fzyEqual(nf1fzy) shouldBe !nf1.isNaN()116 }117 }118 test("Float.fzyEqual tol pathology") {119 checkAll(Arb.numericFloats(), Arb.float()) { nfQty, nfTol ->120 val tol = Math.abs(nfTol)121 val nf1fzy = FzyFloat(nfQty, tol, defeatOk = true)122 nfQty.fzyEqual(nf1fzy) shouldBe !tol.isNaN()123 nfQty.fzyEqual(nfQty.asFzyFloat(alterFloatTol)) shouldBe true124 nfQty.fzyEqual(nfQty, tol) shouldBe !tol.isNaN()125 nf1fzy.fzyEqual(nfQty) shouldBe !tol.isNaN()126 nf1fzy.fzyEqual(nf1fzy) shouldBe !tol.isNaN()127 }128 }129})...

Full Screen

Full Screen

floats.kt

Source:floats.kt Github

copy

Full Screen

1package io.kotest.property.arbitrary2import io.kotest.property.Arb3import io.kotest.property.Gen4import io.kotest.property.Shrinker5import kotlin.math.absoluteValue6private val numericEdgeCases = listOf(-1.0F, -Float.MIN_VALUE, -0.0F, 0.0F, Float.MIN_VALUE, 1.0F)7private val nonFiniteEdgeCases = listOf(Float.NEGATIVE_INFINITY, Float.NaN, Float.POSITIVE_INFINITY)8object FloatShrinker : Shrinker<Float> {9 override fun shrink(value: Float): List<Float> =10 if (value == 0f || !value.isFinite() || value.absoluteValue < 10 * Float.MIN_VALUE)11 emptyList()12 else13 listOfNotNull(DoubleShrinker.shrink(value.toString())?.toFloat())14}15/**16 * Returns an [Arb] that produces [Float]s from [min] to [max] (inclusive).17 * The edge cases are [Float.NEGATIVE_INFINITY], [min], -1.0, -[Float.MIN_VALUE], -0.0, 0.0, [Float.MIN_VALUE], 1.0,18 * [max], [Float.POSITIVE_INFINITY] and [Float.NaN] which are only included if they are in the provided range.19 *20 * @see numericFloat to only produce numeric [Float]s21 */22fun Arb.Companion.float(min: Float = -Float.MAX_VALUE, max: Float = Float.MAX_VALUE): Arb<Float> = float(min..max)23/**24 * Returns an [Arb] that produces [Float]s in [range].25 * The edge cases are [Float.NEGATIVE_INFINITY], [ClosedFloatingPointRange.start], -1.0, -[Float.MIN_VALUE], -0.0,26 * 0.0, [Float.MIN_VALUE], 1.0, [ClosedFloatingPointRange.endInclusive], [Float.POSITIVE_INFINITY] and [Float.NaN] which27 * are only included if they are in the provided range.28 */29fun Arb.Companion.float(range: ClosedFloatingPointRange<Float> = -Float.MAX_VALUE..Float.MAX_VALUE): Arb<Float> =30 arbitrary(31 (numericEdgeCases.filter { it in range } +32 listOf(-1.0F, -0.0F, 0.0F, 1.0F).filter { it in range }.map { it / 0.0F } +33 listOf(range.start, range.endInclusive)34 ).distinct(),35 FloatShrinker36 ) {37 it.random.nextDouble(range.start.toDouble(), range.endInclusive.toDouble()).toFloat()38 }39/**40 * Returns an [Arb] that produces positive [Float]s from [Float.MIN_VALUE] to [max] (inclusive).41 * The edge cases are [Float.MIN_VALUE], 1.0, [max] and [Float.POSITIVE_INFINITY] which are only included if they are42 * in the provided range.43 */44fun Arb.Companion.positiveFloat(): Arb<Float> = float(Float.MIN_VALUE, Float.MAX_VALUE)45/**46 * Returns an [Arb] that produces negative [Float]s from [min] to -[Float.MIN_VALUE] (inclusive).47 * The edge cases are [Float.NEGATIVE_INFINITY], [min], -1.0 and -[Float.MIN_VALUE] which are only included if they48 * are in the provided range.49 */50fun Arb.Companion.negativeFloat(): Arb<Float> = float(-Float.MAX_VALUE, -Float.MIN_VALUE)51/**52 * Returns an [Arb] that produces numeric [Float]s from [min] to [max] (inclusive).53 * The edge cases are [min], -1.0, -[Float.MIN_VALUE], -0.0, 0.0, [Float.MIN_VALUE], 1.0 and [max] which are only54 * included if they are in the provided range.55 *56 * @see float to also have non numeric [Float]s as edge cases.57 */58fun Arb.Companion.numericFloat(59 min: Float = -Float.MAX_VALUE,60 max: Float = Float.MAX_VALUE61): Arb<Float> = arbitrary((numericEdgeCases.filter { it in min..max } + listOf(min, max)).distinct(), FloatShrinker) {62 it.random.nextDouble(min.toDouble(), max.toDouble()).toFloat()63}64@Deprecated("use numericFloat", ReplaceWith("numericFloat(from, to)"))65fun Arb.Companion.numericFloats(from: Float = -Float.MAX_VALUE, to: Float = Float.MAX_VALUE): Arb<Float> =66 numericFloat(from, to)67/**68 * Returns an [Arb] that produces [FloatArray]s where [length] produces the length of the arrays and69 * [content] produces the content of the arrays.70 */71fun Arb.Companion.floatArray(length: Gen<Int>, content: Arb<Float>): Arb<FloatArray> =72 toPrimitiveArray(length, content, Collection<Float>::toFloatArray)...

Full Screen

Full Screen

Arb.Companion.float

Using AI Code Generation

copy

Full Screen

1import io.kotest.core.spec.style.StringSpec2import io.kotest.matchers.shouldBe3import io.kotest.property.Arb4import io.kotest.property.arbitrary.floats5import io.kotest.property.checkAll6class FloatTest : StringSpec({7“Float should be in range” {8checkAll(Arb.floats(-100.0f, 100.0f)) {9}10}11})12import io.kotest.core.spec.style.StringSpec13import io.kotest.matchers.shouldBe14import io.kotest.property.Arb15import io.kotest.property.arbitrary.doubles16import io.kotest.property.checkAll17class DoubleTest : StringSpec({18“Double should be in range” {19checkAll(Arb.doubles(-100.0, 100.0)) {20}21}22})23import io.kotest.core.spec.style.StringSpec24import io.kotest.matchers.shouldBe25import io.kotest.property.Arb26import io.kotest.property.arbitrary.ints27import io.kotest.property.checkAll28class IntTest : StringSpec({29“Int should be in range” {30checkAll(Arb.ints(-100, 100)) {31}32}33})34import io.kotest.core.spec.style.StringSpec35import io.kotest.matchers.shouldBe36import io.kotest.property.Arb37import io.kotest.property.arbitrary.longs38import io.kotest.property.checkAll39class LongTest : StringSpec({40“Long should be in range” {41checkAll(Arb.longs(-100, 100)) {42}43}44})45import io.kotest.core.spec.style.StringSpec46import io.kotest.matchers.shouldBe47import io.kotest.property.Arb48import io.kotest.property.arbitrary.strings49import io.kotest.property.checkAll50class StringTest : StringSpec({51“String should be in range” {52checkAll(Arb.strings

Full Screen

Full Screen

Arb.Companion.float

Using AI Code Generation

copy

Full Screen

1fun main() {2val arb = Arb.float(0.0f, 100.0f)3val config = PropTestConfig(invocations = 10)4propTest(config, arb) { a ->5println(a)6}7}8fun main() {9val arb = Arb.int(-100, 100)10val config = PropTestConfig(invocations = 10)11propTest(config, arb) { a ->12println(a)13}14}15fun main() {16val arb = Arb.long(-100, 100)17val config = PropTestConfig(invocations = 10)18propTest(config, arb) { a ->19println(a)20}21}22fun main() {23val arb = Arb.string(10)24val config = PropTestConfig(invocations = 10)25propTest(config, arb) { a ->26println(a)27}28}29fun main() {30val arb = Arb.string(10, 20)31val config = PropTestConfig(invocations = 10)32propTest(config, arb) { a ->33println(a)34}35}36fun main() {37val arb = Arb.string(10, 20, CharRange('a', 'z'))38val config = PropTestConfig(invocations = 10)39propTest(config, arb) { a ->40println(a)41}42}43fun main() {44val arb = Arb.string(10, 20, CharRange('a', 'z'), CharRange('A', 'Z'))45val config = PropTestConfig(invocations = 10)46propTest(config, arb) { a ->47println(a)48}49}50fun main() {51val arb = Arb.string(10, 20, CharRange('a', 'z'), CharRange('A', 'Z'), CharRange('0', '9'))

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Kotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful