# Macro deltae::assert_delta_eq
[−][src]

    macro_rules! assert_delta_eq {
        ($reference : expr, $sample : expr, $method : expr, $tolerance : expr) => { ... };
        ($reference : expr, $sample : expr, $method : expr, $tolerance : expr,
     $($message : tt) *) => { ... };
    }

Expand description

Convenience macro for asserting two values are equivalent within a tolerance

    use deltae::*;

    let lab0 = LabValue::new(50.0, 0.0, 0.0).unwrap();
    let lab1 = LabValue::new(50.1, 0.1, 0.1).unwrap();

    // Assert that the difference between lab0 and lab1 is less than 1.0 DE2000
    assert_delta_eq!(lab0, lab1, DE2000, 1.0);