15 lines
394 B
Rust
15 lines
394 B
Rust
macro_rules! assert_approx_eq {
|
|
($a:expr, $b:expr, $eps:expr) => {{
|
|
let (a, b) = (&$a, &$b);
|
|
assert!(
|
|
(*a - *b).abs() < $eps,
|
|
"assertion failed: `(left !== right)` \
|
|
(left: `{:?}`, right: `{:?}`, expect diff: `{:?}`, real diff: `{:?}`)",
|
|
*a,
|
|
*b,
|
|
$eps,
|
|
(*a - *b).abs()
|
|
);
|
|
}};
|
|
}
|