kotest-assertions-core / io.kotest.matchers.doubles / kotlin.Double / plusOrMinus

plusOrMinus

infix fun Double.plusOrMinus(tolerance: Double): ToleranceMatcher

Creates a matcher for the interval [this - tolerance , this + tolerance]

0.1 shouldBe (0.4 plusOrMinus 0.5)   // Assertion passes
0.1 shouldBe (0.4 plusOrMinus 0.2)   // Assertion fails