Skip to content
Snippets Groups Projects
  • Jerome Humbert's avatar
    Add `assert_approx_eq!()` testing macro (#66) · dd6ac741
    Jerome Humbert authored
    Clarify testing code and potential assertions message with the use of a
    new `assert_approx_eq!()` macro for `f32` equality check with a
    tolerance. The macro leverages `abs_diff_eq()` but produces a better
    assertion message in case of failure. It also allows skipping the
    tolerance parameter to use the default of `1e-5`, which is the
    "standard" tolerance to use for progress and other small-ish values that
    are expected to be equal but might be slightly off due to rounding
    errors.
    
    This change ignores the complications of testing for floating-point
    equality in a generic way, which is too complex, and instead restrict
    the usage to values like progress (range [0:1]) and other small position
    values around the origin.
    Unverified
    dd6ac741