Macro russell_chk::assert_vec_approx_eq [−][src]
macro_rules! assert_vec_approx_eq {
($a : expr, $b : expr, $tol : expr) => { ... };
}
Expand description
Asserts that two vectors have the same length and approximately equal values.
On panic, this macro will print the values of the expressions with their debug representations.
A tolerance must be given for the absolute comparison of float-point numbers.
Code inspired by assert_approx_eq
Examples
let a = [1.0, 2.0, 3.0000001];
let b = [1.0, 2.0, 3.0];
assert_vec_approx_eq!(a, b, 1e-6);
ⓘ
let a = [1.0, 2.0, 3.0];
let b = [1.0, 2.0];
assert_vec_approx_eq!(a, b, 1e-6);