diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-05-19 07:29:24 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-05-19 07:29:24 +0000 |
commit | 5be776e2da15610c73a6e149d95663943b7d0a4d (patch) | |
tree | c8cb28aebb96a02c0b1e65a39b547041357c4790 | |
parent | 724d8c8acbbae72a67560def356a210b4ef92d39 (diff) | |
download | mpfr-5be776e2da15610c73a6e149d95663943b7d0a4d.tar.gz |
[tests/tests.c] Re-added code testing FE_DIVBYZERO and FE_INVALID with
-DMPFR_TESTS_DIVBYZERO -DMPFR_ERRDIVZERO, because MPFR_TESTS_EXCEPTIONS
is not ready yet.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11491 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | tests/tests.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/tests.c b/tests/tests.c index 9d10c6841..274d30884 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -291,20 +291,37 @@ tests_end_mpfr (void) if (!tests_memory_disabled) tests_memory_end (); -#ifdef MPFR_TESTS_EXCEPTIONS +#if defined(MPFR_TESTS_DIVBYZERO) || defined(MPFR_TESTS_EXCEPTIONS) if (fetestexcept (FE_ALL_EXCEPT ^ FE_INEXACT)) { printf ("A floating-point exception occurred:"); if (fetestexcept (FE_DIVBYZERO)) - printf (" DIVBYZERO"); + { + printf (" DIVBYZERO"); +#ifdef MPFR_ERRDIVZERO + /* This should never occur because the purpose of defining + MPFR_ERRDIVZERO is to avoid all the FP divisions by 0. */ + err = 1; +#endif + } if (fetestexcept (FE_INVALID)) - printf (" INVALID"); + { + printf (" INVALID"); +#ifdef MPFR_ERRDIVZERO + /* This should never occur because the purpose of defining + MPFR_ERRDIVZERO is to avoid all the FP divisions by 0. + Note: FE_INVALID comes from 0.0 / 0.0, in particular. */ + err = 1; +#endif + } if (fetestexcept (FE_OVERFLOW)) printf (" OVERFLOW"); if (fetestexcept (FE_UNDERFLOW)) printf (" UNDERFLOW"); printf ("\n"); +#ifdef MPFR_TESTS_EXCEPTIONS err = 1; +#endif } #endif |