Skip to content
Snippets Groups Projects
Unverified Commit dd6ac741 authored by Jerome Humbert's avatar Jerome Humbert Committed by GitHub
Browse files

Add `assert_approx_eq!()` testing macro (#66)

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.
parent 15c5bdbd
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment