doc / ch.tutteli.atrium.api.cc.en_UK / toBeWithErrorTolerance

toBeWithErrorTolerance

fun Assert<Float>.toBeWithErrorTolerance(expected: Float, tolerance: Float): AssertionPlant<Float>
fun Assert<Double>.toBeWithErrorTolerance(expected: Double, tolerance: Double): AssertionPlant<Double>
fun Assert<BigDecimal>.toBeWithErrorTolerance(expected: BigDecimal, tolerance: BigDecimal): AssertionPlant<BigDecimal>

Makes the assertion that AssertionPlant.subject is equal to expected with an error tolerance (range including bounds).

It effectively compares the absolute difference between AssertionPlant.subject and expected and compares it with the tolerance. As long as it is less than or equal the tolerance the assertion holds; otherwise it fails. A more mathematical way of expressing the assertion is the following inequality:

| AssertionPlant.subject - expected | ≤ tolerance

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
This plant to support a fluent API.