#[doc = crate::_tags!(assert)]
#[doc = crate::_doc_location!("code/util")]
#[macro_export]
#[cfg_attr(cargo_primary_package, doc(hidden))]
macro_rules! assert_eq_all {
($first:expr, $($rest:expr),+ $(,)?) => {{
let first_val = &$first;
$(
let rest_val = &$rest;
assert!(
first_val == rest_val,
"Assertion failed: ({}) is not equal to ({})\n left: {}\n right: {}",
stringify!($first),
stringify!($rest),
first_val,
rest_val,
);
)+
}};
}
#[doc(inline)]
pub use assert_eq_all;
#[doc = crate::_tags!(assert)]
#[doc = crate::_doc_location!("code/util")]
#[macro_export]
#[cfg_attr(cargo_primary_package, doc(hidden))]
macro_rules! assert_approx_eq_all {
(tolerance: $tolerance:expr, $first:expr, $($rest:expr),+ $(,)?) => {{
let first_val = $first;
$(
let rest_val = $rest;
let difference =
if first_val > rest_val { first_val - rest_val } else { rest_val - first_val };
assert!(
difference <= $tolerance,
"Assertion failed: ({}) is not approximately equal to ({})
left: {}\n right: {}\n tolerance: {}",
stringify!($first), stringify!($rest), first_val, rest_val, $tolerance,
);
)+
}};
}
#[doc(inline)]
pub use assert_approx_eq_all;