
commonMain.io.kotest.properties.shrinking.DoubleShrinker.kt Maven / Gradle / Ivy
package io.kotest.properties.shrinking
import kotlin.math.abs
import kotlin.math.round
object DoubleShrinker : Shrinker {
override fun shrink(failure: Double): List {
return if (failure == 0.0) emptyList() else {
val a = listOf(0.0, 1.0, -1.0, abs(failure), failure / 3, failure / 2)
val b = (1..5).map { failure - it }.reversed().filter { it > 0 }
(a + b + round(failure)).distinct()
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy