Function galvanic_assert::matchers::close_to [] [src]

pub fn close_to<'a, T>(expected: T, eps: T) -> Box<Matcher<'a, T> + 'a> where
    T: Copy + PartialOrd + Add<Output = T> + Sub<Output = T> + Debug + 'a, 

Matches if the asserted value is in an epsilon range around the expected value.

If floating point values are compared for equality this matcher should be used instead of [equal_to]

Examples

use galvanic_assert::matchers::*;
assert_that!(&(1.2 + 3.14), close_to(4.34, 0.00001));