Skip to content

Commit

Permalink
set single percision eps for tests
Browse files Browse the repository at this point in the history
some tests were failing due to being just slighty outside the
eps for single percision. Increase it a bit to pass the test
case.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
  • Loading branch information
XenuIsWatching committed Dec 12, 2023
1 parent 4fd784b commit ee68842
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/src/phy_grav_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ ZTEST(zsl_tests, test_phy_grav_force)

rc = zsl_phy_grav_force(1E15, 200.0, 500.0, &f);
zassert_true(rc == 0, NULL);
#ifdef CONFIG_ZSL_SINGLE_PRECISION
zassert_true(val_is_equal(f, -53.39264, 1E-5), NULL);
#else
zassert_true(val_is_equal(f, -53.39264, 1E-6), NULL);
#endif

rc = zsl_phy_grav_force(1E15, 200.0, 0.0, &f);
zassert_true(rc == -EINVAL, NULL);
Expand All @@ -93,8 +97,11 @@ ZTEST(zsl_tests, test_phy_grav_pot_ener)

rc = zsl_phy_grav_pot_ener(1E15, 200.0, 500.0, &u);
zassert_true(rc == 0, NULL);
#ifdef CONFIG_ZSL_SINGLE_PRECISION
zassert_true(val_is_equal(u, -26.69632, 1E-5), NULL);
#else
zassert_true(val_is_equal(u, -26.69632, 1E-6), NULL);

#endif
rc = zsl_phy_grav_pot_ener(1E15, 200.0, 0.0, &u);
zassert_true(rc == -EINVAL, NULL);
/* IEEE standard states that x != x is true only for NAN values. */
Expand Down

0 comments on commit ee68842

Please sign in to comment.