|got - want| <= tolerance. NaN is never near anything.
expect_near(0.5, 0.25, 0.1);This one is meant to fail, so there is nothing to run.
expect_near("half", 0.5, 0.1);This one is meant not to compile.
- got: the value under test.
- want: the value it should be close to.
- tolerance: the largest allowed difference.
- loc: where the check is written, shown when it fails. Leave the default.
expect_near :: (
got: float64,
want: float64,
tolerance: float64,
loc := #caller_location
) -> bool
|got - want| <= tolerance. NaN is never near anything.
Parameters
- got: float64
- the value under test.
- want: float64
- the value it should be close to.
- tolerance: float64
- the largest allowed difference.
- loc := #caller_location
- where the check is written, shown when it fails. Leave the default.
Returns
- bool
expect_near(0.5, 0.25, 0.1);This one is meant to fail, so there is nothing to run.
expect_near("half", 0.5, 0.1);This one is meant not to compile.