Expand description
Assert for comparing absolute differences.
These macros help with collection lengths, such as for strings, arrays,
vectors, iterators, and anything that has a typical .len()
method.
Compare an absolute difference with an expression:
-
assert_abs_diff_eq_x!(a, b, x)
≈ | a - b | = x -
assert_abs_diff_ne_x!(a, b, x)
≈ | a - b | ≠ x -
assert_abs_diff_lt_x!(a, b, x)
≈ | a - b | < x -
assert_abs_diff_le_x!(a, b, x)
≈ | a - b | ≤ x -
assert_abs_diff_gt_x!(a, b, x)
≈ | a - b | > x -
assert_abs_diff_ge_x!(a, b, x)
≈ | a - b | ≥ x
§Example
use assertables::*;
let a = 10;
let b = 13;
let x = 3;
assert_abs_diff_eq_x!(a, b, x);
Modules§
- assert_
abs_ diff_ eq - Assert an absolute difference is equal to an expression.
- assert_
abs_ diff_ eq_ x - Assert an absolute difference is equal to an expression.
- assert_
abs_ diff_ ge - Assert an absolute difference is greater than or equal to an expression.
- assert_
abs_ diff_ ge_ x - Assert an absolute difference is greater than or equal to an expression.
- assert_
abs_ diff_ gt - Assert an absolute difference is greater than an expression.
- assert_
abs_ diff_ gt_ x - Assert an absolute difference is greater than an expression.
- assert_
abs_ diff_ le - Assert an absolute difference is less than or equal to an expression.
- assert_
abs_ diff_ le_ x - Assert an absolute difference is less than or equal to an expression.
- assert_
abs_ diff_ lt - Assert an absolute difference is less than an expression.
- assert_
abs_ diff_ lt_ x - Assert an absolute difference is less than an expression.
- assert_
abs_ diff_ ne - Assert an absolute difference is not equal to an expression.
- assert_
abs_ diff_ ne_ x - Assert an absolute difference is not equal to an expression.