How to use test method of io.kotest.matchers.doubles.Between class

Best Kotest code snippet using io.kotest.matchers.doubles.Between.test

matchers.kt

Source:matchers.kt Github

copy

Full Screen

1package tutorial.kotest2import io.kotest.assertions.throwables.shouldThrow3import io.kotest.assertions.throwables.shouldThrowAny4import io.kotest.assertions.throwables.shouldThrowExactly5import io.kotest.core.spec.style.DescribeSpec6import io.kotest.core.test.AssertionMode7import io.kotest.matchers.booleans.shouldBeTrue8import io.kotest.matchers.collections.shouldBeIn9import io.kotest.matchers.collections.shouldBeOneOf10import io.kotest.matchers.collections.shouldBeSameSizeAs11import io.kotest.matchers.collections.shouldBeSingleton12import io.kotest.matchers.collections.shouldBeSmallerThan13import io.kotest.matchers.collections.shouldBeSorted14import io.kotest.matchers.collections.shouldBeUnique15import io.kotest.matchers.collections.shouldContain16import io.kotest.matchers.collections.shouldContainAll17import io.kotest.matchers.collections.shouldContainAnyOf18import io.kotest.matchers.collections.shouldContainDuplicates19import io.kotest.matchers.collections.shouldContainExactly20import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder21import io.kotest.matchers.collections.shouldContainInOrder22import io.kotest.matchers.collections.shouldContainNull23import io.kotest.matchers.collections.shouldEndWith24import io.kotest.matchers.collections.shouldHaveAtLeastSize25import io.kotest.matchers.collections.shouldHaveLowerBound26import io.kotest.matchers.collections.shouldHaveSingleElement27import io.kotest.matchers.collections.shouldHaveSize28import io.kotest.matchers.collections.shouldHaveUpperBound29import io.kotest.matchers.collections.shouldNotContainAnyOf30import io.kotest.matchers.collections.shouldNotHaveElementAt31import io.kotest.matchers.collections.shouldStartWith32import io.kotest.matchers.comparables.shouldBeEqualComparingTo33import io.kotest.matchers.comparables.shouldBeLessThanOrEqualTo34import io.kotest.matchers.date.shouldBeToday35import io.kotest.matchers.date.shouldHaveSameHoursAs36import io.kotest.matchers.doubles.Percentage37import io.kotest.matchers.doubles.beNaN38import io.kotest.matchers.doubles.plusOrMinus39import io.kotest.matchers.doubles.shouldBeNaN40import io.kotest.matchers.doubles.shouldNotBeNaN41import io.kotest.matchers.equality.shouldBeEqualToComparingFields42import io.kotest.matchers.equality.shouldBeEqualToComparingFieldsExcept43import io.kotest.matchers.equality.shouldBeEqualToIgnoringFields44import io.kotest.matchers.equality.shouldBeEqualToUsingFields45import io.kotest.matchers.file.shouldBeADirectory46import io.kotest.matchers.file.shouldBeAbsolute47import io.kotest.matchers.file.shouldExist48import io.kotest.matchers.file.shouldNotBeEmpty49import io.kotest.matchers.ints.beOdd50import io.kotest.matchers.ints.shouldBeBetween51import io.kotest.matchers.ints.shouldBeInRange52import io.kotest.matchers.ints.shouldBeLessThan53import io.kotest.matchers.ints.shouldBeLessThanOrEqual54import io.kotest.matchers.ints.shouldBeOdd55import io.kotest.matchers.ints.shouldBePositive56import io.kotest.matchers.ints.shouldBeZero57import io.kotest.matchers.iterator.shouldBeEmpty58import io.kotest.matchers.iterator.shouldHaveNext59import io.kotest.matchers.maps.shouldBeEmpty60import io.kotest.matchers.maps.shouldContain61import io.kotest.matchers.maps.shouldContainAll62import io.kotest.matchers.maps.shouldContainExactly63import io.kotest.matchers.maps.shouldContainKey64import io.kotest.matchers.nulls.shouldBeNull65import io.kotest.matchers.nulls.shouldNotBeNull66import io.kotest.matchers.shouldBe67import io.kotest.matchers.shouldNot68import io.kotest.matchers.shouldNotBe69import io.kotest.matchers.string.beEmpty70import io.kotest.matchers.string.shouldBeBlank71import io.kotest.matchers.string.shouldBeEmpty72import io.kotest.matchers.string.shouldBeEqualIgnoringCase73import io.kotest.matchers.string.shouldBeInteger74import io.kotest.matchers.string.shouldBeLowerCase75import io.kotest.matchers.string.shouldBeUpperCase76import io.kotest.matchers.string.shouldContain77import io.kotest.matchers.string.shouldContainADigit78import io.kotest.matchers.string.shouldContainIgnoringCase79import io.kotest.matchers.string.shouldContainOnlyDigits80import io.kotest.matchers.string.shouldContainOnlyOnce81import io.kotest.matchers.string.shouldEndWith82import io.kotest.matchers.string.shouldHaveLength83import io.kotest.matchers.string.shouldHaveLineCount84import io.kotest.matchers.string.shouldHaveMaxLength85import io.kotest.matchers.string.shouldHaveMinLength86import io.kotest.matchers.string.shouldHaveSameLengthAs87import io.kotest.matchers.string.shouldMatch88import io.kotest.matchers.string.shouldNotBeEmpty89import io.kotest.matchers.string.shouldStartWith90import io.kotest.matchers.throwable.shouldHaveCause91import io.kotest.matchers.throwable.shouldHaveCauseInstanceOf92import io.kotest.matchers.throwable.shouldHaveCauseOfType93import io.kotest.matchers.throwable.shouldHaveMessage94import io.kotest.matchers.types.shouldBeInstanceOf95import io.kotest.matchers.types.shouldBeSameInstanceAs96import io.kotest.matchers.types.shouldBeTypeOf97import io.kotest.matchers.uri.shouldHaveHost98import io.kotest.matchers.uri.shouldHavePort99import io.kotest.matchers.uri.shouldHaveScheme100import java.io.File101import java.net.URI102import java.time.LocalDate103import java.time.LocalTime104// https://kotest.io/docs/assertions/core-matchers.html105class MatchersTest : DescribeSpec({106 describe("general") {107 it("basics") {108 (1 == 1).shouldBeTrue()109 (2 + 2) shouldBe 4110 val foo: Any = "foobar"111 foo.shouldBeTypeOf<String>() shouldContain "fo"112 "".shouldBeEmpty()113 "x".shouldNot(beEmpty()) // manually negate114 "x".shouldNotBeEmpty() // reusable115 URI("https://tba") shouldHaveHost "tba"116 URI("https://tba:81") shouldHavePort 81117 URI("https://tba") shouldHaveScheme "https"118 File("/").apply {119 shouldExist()120 shouldBeADirectory()121 shouldBeAbsolute()122 shouldNotBeEmpty()123 }124 // executable, hidden, readable, smaller, writeable, containFile, extension, path, ...125 LocalDate.now().shouldBeToday()126 // before/after, within, same, between, have year/month/day/hour/...127 LocalTime.now().shouldHaveSameHoursAs(LocalTime.now())128 // before/after/between, sameMinute/Seconds/Nanos129 }130 it("numbers") {131 1 shouldBeLessThan 2132 1 shouldBeLessThanOrEqual 1 // Int-based; returns this133 1 shouldBeLessThanOrEqualTo 1 // Comparble-based; void134 1 shouldBeEqualComparingTo 1 // Comparable-based135 1.shouldBeBetween(0, 2)136 1 shouldBeInRange 0..2137 0.shouldBeZero()138 1.shouldBePositive()139 1.shouldBeOdd()140 (1.2).shouldBe(1.20001.plusOrMinus(Percentage(20.0)))141 (1.2).shouldNotBeNaN()142 }143 it("strings") {144 // generic: "abc" shouldBe "abc"145 "aBc" shouldBeEqualIgnoringCase "abc"146 "".shouldBeEmpty()147 " ".shouldBeBlank() // empty or whitespace148 "abc" shouldContain ("b")149 "aBc" shouldContainIgnoringCase "bc"150 "x-a-x" shouldContain """\-[a-z]\-""".toRegex()151 "-a-" shouldMatch """\-[a-z]\-""".toRegex()152 "abc" shouldStartWith ("a")153 "abc" shouldEndWith ("c")154 "ab aa" shouldContainOnlyOnce "aa"155 "abc".shouldBeLowerCase()156 "ABC".shouldBeUpperCase()157 "abc" shouldHaveLength 3158 "a\nb" shouldHaveLineCount 2159 "ab" shouldHaveMinLength 1 shouldHaveMaxLength 3160 "abc" shouldHaveSameLengthAs "foo"161 "1".shouldBeInteger()162 "12".shouldContainOnlyDigits()163 "abc1".shouldContainADigit() // at least one164 }165 it("types") {166 @Connotation167 open class SuperType()168 class SubType : SuperType()169 val sameRef = SuperType()170 sameRef.shouldBeSameInstanceAs(sameRef)171 val superType: SuperType = SubType()172 superType.shouldBeTypeOf<SubType>() // exact runtime match (SuperType won't work!)173 superType.shouldBeInstanceOf<SuperType>() // T or below174// SubType().shouldHaveAnnotation(Connotation::class)175 val nullable: String? = null176 nullable.shouldBeNull()177 }178 it("collections") {179 emptyList<Int>().iterator().shouldBeEmpty()180 listOf(1).iterator().shouldHaveNext()181 listOf(1, 2) shouldContain 1 // at least182 listOf(1, 2) shouldContainExactly listOf(1, 2) // in-order; not more183 listOf(1, 2) shouldContainExactlyInAnyOrder listOf(2, 1) // out-order; not more184 listOf(0, 3, 0, 4, 0).shouldContainInOrder(3, 4) // possible items in between185 listOf(1) shouldNotContainAnyOf listOf(2, 3) // black list186 listOf(1, 2, 3) shouldContainAll listOf(3, 2) // out-order; more187 listOf(1, 2, 3).shouldBeUnique() // no duplicates188 listOf(1, 2, 2).shouldContainDuplicates() // at least one duplicate189 listOf(1, 2).shouldNotHaveElementAt(1, 3)190 listOf(1, 2) shouldStartWith 1191 listOf(1, 2) shouldEndWith 2192 listOf(1, 2) shouldContainAnyOf listOf(2, 3)193 val x = SomeType(1)194 x shouldBeOneOf listOf(x) // by reference/instance195 x shouldBeIn listOf(SomeType(1)) // by equality/structural196 listOf(1, 2, null).shouldContainNull()197 listOf(1) shouldHaveSize 1198 listOf(1).shouldBeSingleton() // size == 1199 listOf(1).shouldBeSingleton {200 it.shouldBeOdd()201 }202 listOf(1).shouldHaveSingleElement {203 beOdd().test(it).passed() // have to return a boolean here :-/204 }205 listOf(2, 3) shouldHaveLowerBound 1 shouldHaveUpperBound 4206 listOf(1) shouldBeSmallerThan listOf(1, 2)207 listOf(1) shouldBeSameSizeAs listOf(2)208 listOf(1, 2) shouldHaveAtLeastSize 1209 listOf(1, 2).shouldBeSorted()210 mapOf(1 to "a").shouldContain(1, "a") // at least this211 mapOf(1 to "a") shouldContainAll mapOf(1 to "a") // at least those212 mapOf(1 to "a") shouldContainExactly mapOf(1 to "a") // not more213 mapOf(1 to "a") shouldContainKey 1214 emptyMap<Any, Any>().shouldBeEmpty()215 }216 it("exceptions") {217 class SubException() : Exception()...

Full Screen

Full Screen

TestMapping.kt

Source:TestMapping.kt Github

copy

Full Screen

1package org.openrndr.math2import kotlin.math.absoluteValue3import io.kotest.matchers.doubles.between4import io.kotest.matchers.doubles.plusOrMinus5import io.kotest.matchers.shouldBe6import io.kotest.matchers.shouldNotBe7import org.openrndr.math.test.it8import org.openrndr.math.test.it as describe9import kotlin.test.Test10class TestMapping {11 @Test12 fun shouldDoMappingOperations() {13 describe("Mapping Double from zero-width before domain to non-zero-width after domain") {14 it("should not produce NaN results") {15 map(0.0, 0.0, 0.0, 1.0, 0.0) shouldBe (0.0 plusOrMinus 10E-6)16 map(0.0, 0.0, 0.0, 1.0, 1.0) shouldBe (1.0 plusOrMinus 10E-6)17 }18 }19 describe("Mapping Double from zero-width before domain to zero-width after domain") {20 it("should not produce NaN results") {21 map(0.0, 0.0, 0.0, 0.0, 0.0) shouldBe (0.0 plusOrMinus 10E-6)22 map(0.0, 0.0, 0.0, 0.0, 1.0) shouldBe (0.0 plusOrMinus 10E-6)23 }24 }25 describe("Mapping Double") {26 val beforeLeft = 0.027 val beforeRight = 1.028 val beforeVal = beforeRight * 2.0 // out of range29 val afterLeft = 0.030 val afterRight = beforeRight * 2.031 it("should not clamp") {32 map(33 beforeLeft, beforeRight, afterLeft, afterRight, beforeVal34 ) shouldNotBe between(afterLeft, afterRight, 0.0)35 }36 it("should clamp") {37 map(38 beforeLeft, beforeRight, afterLeft, afterRight, beforeVal, true39 ) shouldBe between(afterLeft, afterRight, 0.0)40 }41 it("should not clamp") {42 beforeVal.map(43 beforeLeft, beforeRight, afterLeft, afterRight44 ) shouldNotBe between(afterLeft, afterRight, 0.0)45 }46 it("should clamp") {47 beforeVal.map(48 beforeLeft, beforeRight, afterLeft, afterRight, true49 ) shouldBe between(afterLeft, afterRight, 0.0)50 }51 }52 describe("Mapping Vector2") {53 val beforeLeft = Vector2.ZERO54 val beforeRight = Vector2.ONE55 val beforeVal = beforeRight * 2.0 // out of range56 val afterLeft = Vector2.ZERO57 val afterRight = beforeRight * 2.058 it("should not clamp") {59 val mapped = beforeVal.map(beforeLeft, beforeRight,60 afterLeft, afterRight)61 for (i in 0 until 2)62 mapped[i] shouldNotBe between(afterLeft[i], afterRight[i], 0.0)63 }64 it("should clamp") {65 val mapped = beforeVal.map(beforeLeft, beforeRight,66 afterLeft, afterRight, true)67 for (i in 0 until 2)68 mapped[i] shouldBe between(afterLeft[i], afterRight[i], 0.0)69 }70 }71 describe("Mapping Vector3") {72 val beforeLeft = Vector3.ZERO73 val beforeRight = Vector3.ONE74 val beforeVal = beforeRight * 2.0 // out of range75 val afterLeft = Vector3.ZERO76 val afterRight = beforeRight * 2.077 it("should not clamp") {78 val mapped = beforeVal.map(beforeLeft, beforeRight,79 afterLeft, afterRight)80 for (i in 0 until 3)81 mapped[i] shouldNotBe between(afterLeft[i], afterRight[i], 0.0)82 }83 it("should clamp") {84 val mapped = beforeVal.map(beforeLeft, beforeRight,85 afterLeft, afterRight, true)86 for (i in 0 until 3)87 mapped[i] shouldBe between(afterLeft[i], afterRight[i], 0.0)88 }89 }90 describe("Mapping Vector4") {91 val beforeLeft = Vector4.ZERO92 val beforeRight = Vector4.ONE93 val beforeVal = beforeRight * 2.0 // out of range94 val afterLeft = Vector4.ZERO95 val afterRight = beforeRight * 2.096 it("should not clamp") {97 val mapped = beforeVal.map(beforeLeft, beforeRight,98 afterLeft, afterRight)99 for (i in 0 until 4)100 mapped[i] shouldNotBe between(afterLeft[i], afterRight[i], 0.0)101 }102 it("should clamp") {103 val mapped = beforeVal.map(beforeLeft, beforeRight,104 afterLeft, afterRight, true)105 for (i in 0 until 4)106 mapped[i] shouldBe between(afterLeft[i], afterRight[i], 0.0)107 }108 }109 }110 @Test111 fun shouldDoMixingOperations() {112 describe("Mixing double") {113 it("should produce expected result") {114 mix(1.0, 3.0, 0.5) shouldBe (2.0 plusOrMinus 10E-6)115 mix(3.0, 1.0, 0.5) shouldBe (2.0 plusOrMinus 10E-6)116 }117 }118 describe("Mixing angles") {119 it("should interpolate via shortest side") {120 mixAngle(5.0, 355.0, 0.5) shouldBe (0.0 plusOrMinus 10E-6)121 mixAngle(355.0, 5.0, 0.5) shouldBe (0.0 plusOrMinus 10E-6)122 mixAngle(-100.0, 100.0, 0.5).absoluteValue shouldBe (180.0 plusOrMinus 10E-6)123 mixAngle(100.0, -100.0, 0.5).absoluteValue shouldBe (180.0 plusOrMinus 10E-6)124 }125 }126 }127}...

Full Screen

Full Screen

OsmTypesTest.kt

Source:OsmTypesTest.kt Github

copy

Full Screen

1package com.jejking.kosmparser.osm2import io.kotest.assertions.throwables.shouldThrow3import io.kotest.core.spec.style.FunSpec4import io.kotest.matchers.shouldBe5import io.kotest.property.Arb6import io.kotest.property.arbitrary.arbitrary7import io.kotest.property.arbitrary.numericDoubles8import io.kotest.property.forAll9import java.time.ZonedDateTime10class OsmTypesTest : FunSpec() {11 private val elementMetadata = ElementMetadata(1, "user", 1, ZonedDateTime.now(), true, 1, 1)12 private val tags = mapOf("foo" to "bar")13 init {14 context("point") {15 test("should accept lat values between -90 and 90 and long between -180 and 180") {16 val edgeCases = listOf(17 Point(0.0, 0.0),18 Point(-90.0, -180.0),19 Point(90.0, 180.0)20 )21 val pointArb: Arb<Point> = arbitrary(edgeCases) { rs ->22 val latitude = Arb.numericDoubles(-90.0, 90.0).sample(rs)23 val longitude = Arb.numericDoubles(-180.0, 180.0).sample(rs)24 Point(latitude.value, longitude.value)25 }26 forAll(pointArb) { p: Point -> LAT_RANGE.contains(p.lat) && LON_RANGE.contains(p.lon) }27 }28 test("should accept lat value of -90") {29 Point(-90.0, 0.0)30 }31 test("should accept lat value of 90") {32 Point(90.0, 0.0)33 }34 test("should accept long value of -180") {35 Point(0.0, -180.0)36 }37 test("should accept long value of 180") {38 Point(0.0, 180.0)39 }40 test("should reject lat value smaller than -90") {41 shouldThrow<IllegalStateException> {42 Point(-90.1, 0.0)43 }44 }45 test("should reject lat value greater than 90") {46 shouldThrow<IllegalStateException> {47 Point(90.1, 0.0)48 }49 }50 test("should reject long value smaller than -180") {51 shouldThrow<IllegalStateException> {52 Point(0.0, -180.1)53 }54 }55 test("should reject long value greater than 180") {56 shouldThrow<IllegalStateException> {57 Point(0.0, 180.1)58 }59 }60 }61 context("way") {62 test("should accept list of 2 nodes") {63 val way = Way(elementMetadata, tags, listOf(1, 2))64 way.isFaulty() shouldBe false65 way.isClosed() shouldBe false66 }67 test("should accept list of 2000 nodes") {68 val way = Way(elementMetadata, tags, (1..2000L).toList())69 way.isFaulty() shouldBe false70 }71 test("should reject list of nodes with 2001 elements") {72 shouldThrow<IllegalStateException> {73 Way(elementMetadata, tags, (1..2001L).toList())74 }75 }76 test("should declare a list of 1 node refs to be faulty") {77 val way = Way(elementMetadata, tags, listOf(1))78 way.isFaulty() shouldBe true79 }80 test("should declare a list of 0 node refs to be faulty") {81 val way = Way(elementMetadata, tags, emptyList())82 way.isFaulty() shouldBe true83 }84 test("should identify a closed way") {85 val way = Way(elementMetadata, tags, listOf(1, 2, 1))86 way.isClosed() shouldBe true87 }88 test("should not identify a faulty way as closed") {89 val way = Way(elementMetadata, tags, listOf(1))90 way.isClosed() shouldBe false91 val way2 = Way(elementMetadata, tags, emptyList())92 way2.isClosed() shouldBe false93 }94 }95 }96}...

Full Screen

Full Screen

TestQuaternion.kt

Source:TestQuaternion.kt Github

copy

Full Screen

1package org.openrndr.math2import io.kotest.matchers.doubles.between3import io.kotest.matchers.shouldBe4import io.kotest.matchers.string.shouldMatch5import kotlinx.serialization.encodeToString6import kotlinx.serialization.json.Json7import org.openrndr.math.test.it8import kotlin.test.Test9class TestQuaternion {10 @Test11 fun shouldDoOperationsOnAQuaternion() {12 it("IDENTITY times IDENTITY should result in IDENTITY") {13 val q0 = Quaternion.IDENTITY14 val q1 = Quaternion.IDENTITY15 val qm = q0 * q116 qm.x shouldBe 0.017 qm.y shouldBe 0.018 qm.z shouldBe 0.019 qm.w shouldBe 1.020 }21 it ("matrix to quaternion to matrix") {22 val q0 = Quaternion.fromMatrix(Matrix33.IDENTITY)...

Full Screen

Full Screen

TestGraphStream.kt

Source:TestGraphStream.kt Github

copy

Full Screen

...5 * This file is part of Alchemist, and is distributed under the terms of the6 * GNU General Public License, with a linking exception,7 * as described in the file LICENSE in the Alchemist distribution's top directory.8 */9package it.unibo.alchemist.test10import io.kotest.core.spec.style.FreeSpec11import io.kotest.matchers.collections.shouldNotBeEmpty12import io.kotest.matchers.doubles.shouldBeLessThan13import io.kotest.matchers.ints.shouldBeExactly14import io.kotest.matchers.ints.shouldBeGreaterThan15import it.unibo.alchemist.loader.LoadAlchemist16import org.kaikikm.threadresloader.ResourceLoader17class TestGraphStream : FreeSpec({18 "the lobster deployment should" - {19 val environment = LoadAlchemist.from(ResourceLoader.getResource("graphstream/testlobster.yml"))20 .getDefault<Nothing, Nothing>()21 .environment22 "displace all nodes" - {23 environment.nodeCount shouldBeExactly 40024 "with neighbors closer than non-neighbors" {25 environment.nodes.forEach { node ->26 val neighborhood = environment.getNeighborhood(node)27 val averageDistances = environment.nodes.asSequence()28 .groupBy { it in neighborhood }29 .mapValues { (_, nodes) ->30 nodes.asSequence()31 .map { environment.getDistanceBetweenNodes(node, it) }32 .average()33 }...

Full Screen

Full Screen

TestInSightConnection.kt

Source:TestInSightConnection.kt Github

copy

Full Screen

...5 * This file is part of Alchemist, and is distributed under the terms of the6 * GNU General Public License, with a linking exception,7 * as described in the file LICENSE in the Alchemist distribution's top directory.8 */9package it.unibo.alchemist.test10import io.kotest.core.spec.style.StringSpec11import io.kotest.matchers.booleans.shouldBeFalse12import io.kotest.matchers.doubles.shouldBeGreaterThan13import io.kotest.matchers.doubles.shouldBeLessThan14import io.kotest.matchers.shouldBe15import io.kotest.matchers.types.instanceOf16import it.unibo.alchemist.loader.LoadAlchemist17import it.unibo.alchemist.model.implementations.environments.OSMEnvironment18import it.unibo.alchemist.model.implementations.linkingrules.ConnectIfInLineOfSigthOnMap19import it.unibo.alchemist.model.interfaces.GeoPosition20import org.kaikikm.threadresloader.ResourceLoader21class TestInSightConnection : StringSpec(22 {23 "environments with in-sight link on maps should be loadable" {24 val environment = LoadAlchemist.from(ResourceLoader.getResource("simulations/connect-sight.yml"))25 .getDefault<Nothing, GeoPosition>()26 .environment as OSMEnvironment27 environment.nodeCount shouldBe 10228 val node0 = environment.getNodeByID(0)29 val node1 = environment.getNodeByID(1)...

Full Screen

Full Screen

CircleTest.kt

Source:CircleTest.kt Github

copy

Full Screen

1package net.trivernis.chunkmaster.lib.shapes2import io.kotest.matchers.booleans.shouldBeTrue3import io.kotest.matchers.collections.shouldContainAll4import io.kotest.matchers.doubles.shouldBeBetween5import io.kotest.matchers.shouldBe6import org.junit.Test7import org.junit.jupiter.api.BeforeEach8class CircleTest {9 private val circle = Circle(center = Pair(0, 0), radius = 2, start = Pair(0, 0))10 @BeforeEach11 fun init() {12 circle.reset()13 }14 @Test15 fun `it generates coordinates`() {16 circle.next().shouldBe(Pair(0, 0))17 circle.next().shouldBe(Pair(-1, -1))18 circle.next().shouldBe(Pair(1, 0))19 circle.next().shouldBe(Pair(-1, 0))...

Full Screen

Full Screen

AbstractGeneratorTest.kt

Source:AbstractGeneratorTest.kt Github

copy

Full Screen

1package net.dinkla.raytracer.samplers2import io.kotest.core.spec.style.AnnotationSpec3import io.kotest.matchers.doubles.shouldBeGreaterThanOrEqual4import io.kotest.matchers.doubles.shouldBeLessThan5import io.kotest.matchers.shouldBe6import net.dinkla.raytracer.math.Histogram7import net.dinkla.raytracer.math.Point2D8abstract class AbstractGeneratorTest : AnnotationSpec() {9 private var samples: MutableList<Point2D> = mutableListOf()10 private val factorX = 10.011 private val factorY = 10.012 open val sizeOfX : Int = factorX.toInt()13 open val sizeOfY : Int = factorY.toInt()14 open val sizeOfXY : Int = factorX.toInt() * factorY.toInt()15 open val numberOfSamples: Int = NUM_SAMPLES * NUM_SETS16 abstract fun sample(): MutableList<Point2D>17 @BeforeEach18 fun initialize() {19 samples = sample()...

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1assertThat(10.0).isBetween(9.0, 11.0)2assertThat(10.0).isBetween(9.0, 11.0)3assertThat(10.0).isBetween(9.0, 11.0)4assertThat(10.0).isBetween(9.0, 11.0)5assertThat(10.0).isBetween(9.0, 11.0)6assertThat(10.0).isBetween(9.0, 11.0)7assertThat(10.0).isBetween(9.0, 11.0)8assertThat(10.0).isBetween(9.0, 11.0)9assertThat(10.0).isBetween(9.0, 11.0)10assertThat(10.0).isBetween(9.0, 11.0)11assertThat(10.0).isBetween(9.0, 11.0)12assertThat(10.0).isBetween(9.0, 11.0)13assertThat(10.0).isBetween(9.0, 11.0)14assertThat(10

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1 fun `test double`() {2 1.0 shouldBe Between(0.5, 1.5)3 }4 fun `test int`() {5 1 shouldBe Between(0, 2)6 }7 fun `test long`() {8 1L shouldBe Between(0L, 2L)9 }10 fun `test short`() {11 1.toShort() shouldBe Between(0.toShort(), 2.toShort())12 }13`fun <T : Number> beNegative(): Matcher<T>`

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1x.shouldBeBetween( 0.0 , 2.0 )2x.shouldBeLessThan( 2.0 )3x.shouldBeLessOrEquals( 2.0 )4x.shouldBeGreaterThan( 0.0 )5x.shouldBeGreaterOrEquals( 0.0 )6x.shouldBeNaN()7x.shouldBePositiveInfinity()8x.shouldBeNegativeInfinity()9x.shouldBeNegativeOrPositiveInfinity()10x.shouldBeFinite()11x.shouldBeInfinite()12x.shouldBeNaNOrInfinite()13x.shouldBeNaNOrFinite()

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