test_util

Macro assert_near

Source
macro_rules! assert_near {
    ($x: expr, $y: expr, $delta: expr) => { ... };
}
Expand description

Asserts that x and y are within delta of one another.

x and y must be of a common type that supports both subtraction and negation. (Note that it would be natural to define this macro using abs(), but when attempting to do so, the compiler fails to apply its inference rule for under-constrained types. See [https://github.com/rust-lang/reference/issues/104].)