diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-05-24 07:15:40 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-05-24 07:15:40 +0000 |
commit | 49aeedbc4cd1c5fad4548acc5cb08ac854af3200 (patch) | |
tree | 1487ce8eb3e8e843d6ae3ac2544e3a530d94a39d | |
parent | ee82b3c89f1068abf531d1d5168d231b7539bca9 (diff) | |
download | mpfr-49aeedbc4cd1c5fad4548acc5cb08ac854af3200.tar.gz |
[tests/tprintf.c] Improved check_vprintf_failure().
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11524 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | tests/tprintf.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/tprintf.c b/tests/tprintf.c index 8130266d0..3c23adf75 100644 --- a/tests/tprintf.c +++ b/tests/tprintf.c @@ -29,6 +29,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include <stdarg.h> #include <stddef.h> +#include <errno.h> #include "mpfr-intmax.h" #include "mpfr-test.h" @@ -95,18 +96,24 @@ static void check_vprintf_failure (const char *fmt, ...) { va_list ap; + int r; va_start (ap, fmt); - if (mpfr_vprintf (fmt, ap) != -1) - { + errno = 0; + r = mpfr_vprintf (fmt, ap); + va_end (ap); + + if (r != -1 +#ifdef EOVERFLOW + || errno != EOVERFLOW +#endif + ) + { putchar ('\n'); fprintf (stderr, "Error 3 in mpfr_vprintf(\"%s\", ...)\n", fmt); - - va_end (ap); exit (1); } putchar ('\n'); - va_end (ap); } /* The goal of this test is to check cases where more INT_MAX characters |