From 705b5a4d2d3b6eeb14b201c097252c5918995d98 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Sun, 18 Aug 2013 20:18:11 +0000 Subject: [PATCH] fix fenv.c tests according to a new interpretation of the standard --- src/math/fenv.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/math/fenv.c b/src/math/fenv.c index 8a2c78e..9603504 100644 --- a/src/math/fenv.c +++ b/src/math/fenv.c @@ -211,27 +211,30 @@ static void test_bad(void) fexcept_t f; int r; - r = fetestexcept(1234567); - if (r == 0) - error("fetestexcept should return non-zero on non-supported exceptions\n"); - r = feraiseexcept(1234567); - if (r == 0) - error("feraiseexcept should return non-zero on non-supported exceptions\n"); - r = feclearexcept(1234567); - if (r == 0) - error("feclearexcept should return non-zero on non-supported exceptions\n"); + r = feclearexcept(FE_ALL_EXCEPT); + if (r != 0) + error("feclearexcept(FE_ALL_EXCEPT) failed\n"); + r = fetestexcept(-1); + if (r != 0) + error("fetestexcept(-1) should return 0 when all exceptions are cleared, got %d\n", r); + r = feraiseexcept(1234567|FE_ALL_EXCEPT); + if (r != 0) + error("feraiseexcept returned non-zero for non-supported exceptions: %d\n", r); + r = feclearexcept(1234567|FE_ALL_EXCEPT); + if (r != 0) + error("feclearexcept returned non-zero for non-supported exceptions: %d\n", r); r = fesetround(1234567); if (r == 0) error("fesetround should fail on invalid rounding mode\n"); r = fegetexceptflag(&f, 1234567); - if (r == 0) - error("fegetexceptflag should return non-zero on non-supported exceptions\n"); + if (r != 0) + error("fegetexceptflag returned non-zero for non-supported exceptions: %d\n", r); r = fegetexceptflag(&f, 0); if (r != 0) error("fegetexceptflag(0) failed\n"); r = fesetexceptflag(&f, 1234567); - if (r == 0) - error("fesetexceptflag should return non-zero on non-supported exceptions\n"); + if (r != 0) + error("fesetexceptflag returned non-zero fir non-supported exceptions: %d\n", r); } int main(void) -- 2.20.1