
commonMain.io.kotest.properties.shrinking.ChooseShrinker.kt Maven / Gradle / Ivy
package io.kotest.properties.shrinking
class ChooseShrinker(val min: Int, val max: Int) : Shrinker {
override fun shrink(failure: Int): List =
when (failure) {
// can't io.kotest.properties.shrinking.shrink further than the min value !
min -> emptyList()
else -> {
val a = listOf(min, failure / 3, failure / 2, failure * 2 / 3)
val b = (1..5).map { failure - it }.reversed()
(a + b).distinct().filter { it >= min }
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy