summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2008-03-11 12:35:57 +0000
committerthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2008-03-11 12:35:57 +0000
commitd940d1215adc0c034ed5b5faf30d49ab6165b0ec (patch)
tree9bb37ec43daf15bff9cb323de0e5f729077dce55
parent0ddbc95bd2c6f7f1b6bf490d4f72916a2feb1347 (diff)
downloadmpfr-d940d1215adc0c034ed5b5faf30d49ab6165b0ec.tar.gz
tests/tfprintf.c: set output to stdout when invocked with one command-line
parameter. tests/tprintf.c: add IO errors processing. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5344 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--tests/tfprintf.c1
-rw-r--r--tests/tprintf.c34
2 files changed, 23 insertions, 12 deletions
diff --git a/tests/tfprintf.c b/tests/tfprintf.c
index b97061393..48664df38 100644
--- a/tests/tfprintf.c
+++ b/tests/tfprintf.c
@@ -338,6 +338,7 @@ main (int argc, char *argv[])
}
else
{
+ fout = stdout;
N = atoi (argv[1]);
}
diff --git a/tests/tprintf.c b/tests/tprintf.c
index f4a29279a..a88357a79 100644
--- a/tests/tprintf.c
+++ b/tests/tprintf.c
@@ -45,9 +45,12 @@ check (char *fmt, mpfr_t x)
{
if (stdout_svg != 0)
{
- fflush (stdout);
- close (fileno (stdout));
- dup (stdout_svg);
+ if ((fflush (stdout) == EOF) || (close (fileno (stdout)) == -1)
+ || (dup (stdout_svg) == -1))
+ {
+ perror ("check");
+ exit (1);
+ }
}
mpfr_printf ("Error in mpfr_printf(\"%s\", %Re)\n", fmt, x);
@@ -65,9 +68,12 @@ check_vprintf (char *fmt, ...)
{
if (stdout_svg != 0)
{
- fflush (stdout);
- close (fileno (stdout));
- dup (stdout_svg);
+ if ((fflush (stdout) == EOF) || (close (fileno (stdout)) == -1)
+ || (dup (stdout_svg) == -1))
+ {
+ perror ("check_vprintf");
+ exit (1);
+ }
}
mpfr_printf ("Error in mpfr_vprintf(\"%s\", ...)\n", fmt);
@@ -293,9 +299,13 @@ check_random (int nb_tests)
{
if (stdout_svg != 0)
{
- fflush (stdout);
- close (fileno (stdout));
- dup (stdout_svg);
+ if ((fflush (stdout) == EOF)
+ || (close (fileno (stdout)) == -1)
+ || (dup (stdout_svg) == -1))
+ {
+ perror ("check_random");
+ exit (1);
+ }
}
mpfr_printf ("Error in mpfr_printf(\"%s\", %d, %s, %Re)\n",
@@ -353,9 +363,9 @@ main (int argc, char *argv[])
if (stdout_svg != 0)
{
- fflush (stdout);
- close (fileno (stdout));
- dup (stdout_svg);
+ if ((fflush (stdout) == EOF) || (close (fileno (stdout)) == -1)
+ || (dup (stdout_svg) == -1))
+ perror ("main");
}
tests_end_mpfr ();
return 0;