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

toBeWithErrorTolerance

fun Expect<Float>.toBeWithErrorTolerance(expected: Float, tolerance: Float): Expect<Float> (source)
Deprecated: Use toEqualWithErrorTolerance; will be removed with 1.0.0 at the latest

Expects that the subject of this expectation (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 this expectation - expected | ≤ tolerance

expect(12.001F).toBeWithErrorTolerance(12.0F, 0.01F)

fails {
    expect(12.1F).toBeWithErrorTolerance(12.0F, 0.01F)
}

Return
an Expect for the subject of this expectation.

fun Expect<Double>.toBeWithErrorTolerance(expected: Double, tolerance: Double): Expect<Double> (source)
Deprecated: Use toEqualWithErrorTolerance; will be removed with 1.0.0 at the latest

Expects that the subject of this expectation (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 this expectation - expected | ≤ tolerance

expect(12.001).toBeWithErrorTolerance(12.0, 0.01)

fails {
    expect(12.1).toBeWithErrorTolerance(12.0, 0.01)
}

Return
an Expect for the subject of this expectation.