Expand description
Assert in nearness.
These macros compare numbers, such as two floating point numbers, where one number may be very close to another number but not quite equal.
-
assert_in_delta!(a, b, delta)≈ | a - b | ≤ Δ -
assert_in_epsilon!(a, b, epsilon)≈ | a - b | ≤ ε * min(a, b)
§Example
use assertables::*;
let a: i8 = 10;
let b: i8 = 11;
let delta: i8 = 1;
assert_in_delta!(a, b, delta);Modules§
- Assert a number is within delta of another number.
- Assert a number is within epsilon of another number.