doc / ch.tutteli.atrium.api.fluent.en_GB / toBeWithErrorTolerance

toBeWithErrorTolerance

fun Expect<Float>.toBeWithErrorTolerance(expected: Float, tolerance: Float): Expect<Float>

Expects that the subject of the assertion (a Float) is equal to expected with an error tolerance (range including bounds).

In detail, It compares the absolute difference between the subject and expected; 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:

| subject of the assertion - expected | ≤ tolerance

Exceptions

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

Return
This assertion container to support a fluent API.

fun Expect<Double>.toBeWithErrorTolerance(expected: Double, tolerance: Double): Expect<Double>

Expects that the subject of the assertion (a Double) is equal to expected with an error tolerance (range including bounds).

In detail, It compares the absolute difference between the subject and expected; 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:

| subject of the assertion - expected | ≤ tolerance

Exceptions

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

Return
This assertion container to support a fluent API.

fun <T : BigDecimal> Expect<T>.toBeWithErrorTolerance(expected: BigDecimal, tolerance: BigDecimal): Expect<T>

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

In detail, It compares the absolute difference between the subject and expected; 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:

| subject of the assertion - expected | ≤ tolerance

Exceptions

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

Return
This assertion container to support a fluent API.