Skip to content

Commit

Permalink
[libc][math] fmod: clear exceptions before the test instead of after
Browse files Browse the repository at this point in the history
The test has no control over the CPU state before the test runs.

This test checks whether no exception flags are set, which may not be
true at the start of the test. This used to be not a problem because the
check was broken but that was fixed in ecfb5d9
  • Loading branch information
d0k committed May 7, 2024
1 parent 227fe1c commit 1d87465
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libc/test/src/math/FModTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#include "hdr/math_macros.h"

#define TEST_SPECIAL(x, y, expected, dom_err, expected_exception) \
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \
EXPECT_FP_EQ(expected, f(x, y)); \
EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \
EXPECT_FP_EXCEPTION(expected_exception); \
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT)
EXPECT_FP_EXCEPTION(expected_exception)

#define TEST_REGULAR(x, y, expected) TEST_SPECIAL(x, y, expected, false, 0)

Expand Down

0 comments on commit 1d87465

Please sign in to comment.