diff --git a/modules/testing/src/main/kotlin/no/vegvesen/saga/modules/testing/KotestAssertionExtensions.kt b/modules/testing/src/main/kotlin/no/vegvesen/saga/modules/testing/KotestAssertionExtensions.kt index 1259b6f3..90c10266 100644 --- a/modules/testing/src/main/kotlin/no/vegvesen/saga/modules/testing/KotestAssertionExtensions.kt +++ b/modules/testing/src/main/kotlin/no/vegvesen/saga/modules/testing/KotestAssertionExtensions.kt @@ -1,6 +1,7 @@ package no.vegvesen.saga.modules.testing import io.kotest.matchers.collections.shouldHaveSize +import io.kotest.matchers.doubles.shouldBeBetween import io.kotest.matchers.nulls.shouldNotBeNull fun Collection?.shouldContainSingle(match: (t: T) -> Boolean): T { @@ -10,3 +11,7 @@ fun Collection?.shouldContainSingle(match: (t: T) -> Boolean): T { it.single() } } + +fun Double.shouldBeCloseTo(value: Double, tolerance: Double) { + this.shouldBeBetween(value, value, tolerance) +}