kotest-assertions-core / io.kotest.matchers.stats / kotlin.collections.Collection / shouldNotHaveVariance

shouldNotHaveVariance

fun <T : Number> Collection<T>.shouldNotHaveVariance(value: BigDecimal, precision: Int = 4): Unit

Asserts that variance of the Collection elements doesn't equal to value with default or specific precision. Default precision equals 4 digits after decimal point.

Opposite of shouldHaveVariance

Example:

val collection = listOf(1, 2, 3)

collection.shouldNotHaveVariance(BigDecimal("1.01"), 5)        // Assertion passes
collection.shouldNotHaveVariance(BigDecimal("0.666667"))       // Assertion passes

collection.shouldNotHaveVariance(BigDecimal("0.6667"))         // Assertion fails
collection.shouldNotHaveVariance(BigDecimal("0.66667"), 5)     // Assertion fails

Parameters

value -

precision -

fun <T : Number> Collection<T>.shouldNotHaveVariance(value: Double, precision: Int = 4): Unit

Asserts that variance of the Collection elements doesn't equal to value with default or specific precision. Default precision equals 4 digits after decimal point.

Opposite of shouldHaveVariance

Example:

val collection = listOf(1, 2, 3)

collection.shouldNotHaveVariance(1.01, 5)        // Assertion passes
collection.shouldNotHaveVariance(0.666667)       // Assertion passes

collection.shouldNotHaveVariance(0.6667)         // Assertion fails
collection.shouldNotHaveVariance(0.66667, 5)     // Assertion fails

Parameters

value -

precision -