toEqualWithErrorTolerance

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 expectation holds; otherwise it fails. A more mathematical way of expressing the expectation is the following inequality:

| subject of thisexpectation - expected | ≤ tolerance

Return

an Expect for the subject of this expectation.

Since

0.17.0

Samples

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

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

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 expectation holds; otherwise it fails. A more mathematical way of expressing the expectation is the following inequality:

| subject of thisexpectation - expected | ≤ tolerance

Return

an Expect for the subject of this expectation.

Since

0.17.0

Samples

expect(12.001).toEqualWithErrorTolerance(12.0, 0.01)

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