Macro matrixcompare::assert_scalar_eq[][src]

macro_rules! assert_scalar_eq {
    ($($args:tt)*) => { ... };
}

Compare scalars for exact or approximate equality.

This macro works analogously to assert_matrix_eq!, but is used for comparing scalars (e.g. integers, floating-point numbers) rather than matrices. Please see the documentation for assert_matrix_eq! for details about issues that arise when comparing floating-point numbers, as well as an explanation for how these macros can be used to resolve these issues.

Examples

let x = 3.00;
let y = 3.05;
// Assert that |x - y| <= 0.1
assert_scalar_eq!(x, y, comp = abs, tol = 0.1);