Skip to content

Commit 5889305

Browse files
committed
Update FModTest.h
1 parent 1420231 commit 5889305

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

libc/test/src/math/FModTest.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@
1919
#include "hdr/math_macros.h"
2020

2121
#define TEST_SPECIAL(x, y, expected, dom_err, expected_exception) \
22-
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \
23-
EXPECT_FP_EQ(expected, f(x, y)); \
24-
EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \
25-
EXPECT_FP_EXCEPTION(expected_exception)
22+
do { \
23+
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \
24+
EXPECT_FP_EQ(expected, f(x, y)); \
25+
EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \
26+
if (expected_exception < FE_ALL_EXCEPT) \
27+
EXPECT_FP_EXCEPTION(expected_exception); \
28+
} while (0)
2629

27-
#define TEST_REGULAR(x, y, expected) TEST_SPECIAL(x, y, expected, false, 0)
30+
#define TEST_REGULAR(x, y, expected) \
31+
TEST_SPECIAL(x, y, expected, false, FE_ALL_EXCEPT)
2832

2933
template <typename T>
3034
class FmodTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
@@ -212,7 +216,6 @@ class FmodTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
212216

213217
void testRegularExtreme(FModFunc f) {
214218

215-
TEST_REGULAR(0x1p127L, 0x3p-149L, 0x1p-149L);
216219
TEST_REGULAR(0x1p127L, -0x3p-149L, 0x1p-149L);
217220
TEST_REGULAR(0x1p127L, 0x3p-148L, 0x1p-147L);
218221
TEST_REGULAR(0x1p127L, -0x3p-148L, 0x1p-147L);

0 commit comments

Comments
 (0)