Mercurial > hg > octave-lyh > gnulib-hg
changeset 8642:a6f02271aae1
FreeBSD 6.1 produces different printf output than glibc.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Thu, 05 Apr 2007 00:27:44 +0000 |
parents | f9017cc714cc |
children | 013fc89d552c |
files | ChangeLog tests/test-fprintf-posix.h tests/test-fprintf-posix.out tests/test-snprintf-posix.h tests/test-sprintf-posix.h tests/test-vasnprintf-posix.c tests/test-vasprintf-posix.c |
diffstat | 7 files changed, 43 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-04-04 Bruno Haible <bruno@clisp.org> + + * tests/test-vasnprintf-posix.c (test_function): Allow two possible + results for "%010a" of Infinity and NaN. + * tests/test-vasprintf-posix.c (test_function): Likewise. + * tests/test-snprintf-posix.h (test_function): Likewise. + * tests/test-sprintf-posix.h (test_function): Likewise. + * tests/test-fprintf-posix.h (test_function): Remove these tests. + * tests/test-fprintf-posix.out: Update. + Needed for FreeBSD 6.1. + 2007-04-04 Bruno Haible <bruno@clisp.org> * DEPENDENCIES: Remove mentions of tar and gzip, since they are not
--- a/tests/test-fprintf-posix.h +++ b/tests/test-fprintf-posix.h @@ -61,12 +61,6 @@ /* NaN. */ my_fprintf (stdout, "%a %d\n", NaN (), 33, 44, 55); - /* FLAG_ZERO with infinite number. */ - my_fprintf (stdout, "%010a %d\n", 1.0 / 0.0, 33, 44, 55); - - /* FLAG_ZERO with NaN. */ - my_fprintf (stdout, "%010a %d\n", NaN (), 33, 44, 55); - /* Test the support of the POSIX/XSI format strings with positions. */ my_fprintf (stdout, "%2$d %1$d\n", 33, 55);
--- a/tests/test-fprintf-posix.out +++ b/tests/test-fprintf-posix.out @@ -6,6 +6,4 @@ inf 33 -inf 33 nan 33 - inf 33 - nan 33 55 33
--- a/tests/test-snprintf-posix.h +++ b/tests/test-snprintf-posix.h @@ -341,7 +341,8 @@ char result[100]; int retval = my_snprintf (result, sizeof (result), "%010a %d", 1.0 / 0.0, 33, 44, 55); - ASSERT (strcmp (result, " inf 33") == 0); + ASSERT (strcmp (result, " inf 33") == 0 + || strcmp (result, "0000000inf 33") == 0); ASSERT (retval == strlen (result)); } @@ -349,7 +350,8 @@ char result[100]; int retval = my_snprintf (result, sizeof (result), "%010a %d", NaN (), 33, 44, 55); - ASSERT (strcmp (result, " nan 33") == 0); + ASSERT (strcmp (result, " nan 33") == 0 + || strcmp (result, "0000000nan 33") == 0); ASSERT (retval == strlen (result)); } @@ -599,7 +601,8 @@ char result[100]; int retval = my_snprintf (result, sizeof (result), "%010La %d", 1.0L / 0.0L, 33, 44, 55); - ASSERT (strcmp (result, " inf 33") == 0); + ASSERT (strcmp (result, " inf 33") == 0 + || strcmp (result, "0000000inf 33") == 0); ASSERT (retval == strlen (result)); } @@ -607,7 +610,8 @@ char result[100]; int retval = my_snprintf (result, sizeof (result), "%010La %d", 0.0L / 0.0L, 33, 44, 55); - ASSERT (strcmp (result, " nan 33") == 0); + ASSERT (strcmp (result, " nan 33") == 0 + || strcmp (result, "0000000nan 33") == 0); ASSERT (retval == strlen (result)); }
--- a/tests/test-sprintf-posix.h +++ b/tests/test-sprintf-posix.h @@ -327,7 +327,8 @@ char result[1000]; int retval = my_sprintf (result, "%010a %d", 1.0 / 0.0, 33, 44, 55); - ASSERT (strcmp (result, " inf 33") == 0); + ASSERT (strcmp (result, " inf 33") == 0 + || strcmp (result, "0000000inf 33") == 0); ASSERT (retval == strlen (result)); } @@ -335,7 +336,8 @@ char result[1000]; int retval = my_sprintf (result, "%010a %d", NaN (), 33, 44, 55); - ASSERT (strcmp (result, " nan 33") == 0); + ASSERT (strcmp (result, " nan 33") == 0 + || strcmp (result, "0000000nan 33") == 0); ASSERT (retval == strlen (result)); } @@ -585,7 +587,8 @@ char result[1000]; int retval = my_sprintf (result, "%010La %d", 1.0L / 0.0L, 33, 44, 55); - ASSERT (strcmp (result, " inf 33") == 0); + ASSERT (strcmp (result, " inf 33") == 0 + || strcmp (result, "0000000inf 33") == 0); ASSERT (retval == strlen (result)); } @@ -593,7 +596,8 @@ char result[1000]; int retval = my_sprintf (result, "%010La %d", 0.0L / 0.0L, 33, 44, 55); - ASSERT (strcmp (result, " nan 33") == 0); + ASSERT (strcmp (result, " nan 33") == 0 + || strcmp (result, "0000000nan 33") == 0); ASSERT (retval == strlen (result)); }
--- a/tests/test-vasnprintf-posix.c +++ b/tests/test-vasnprintf-posix.c @@ -416,7 +416,8 @@ char *result = my_asnprintf (NULL, &length, "%010a %d", 1.0 / 0.0, 33, 44, 55); ASSERT (result != NULL); - ASSERT (strcmp (result, " inf 33") == 0); + ASSERT (strcmp (result, " inf 33") == 0 + || strcmp (result, "0000000inf 33") == 0); ASSERT (length == strlen (result)); free (result); } @@ -426,7 +427,8 @@ char *result = my_asnprintf (NULL, &length, "%010a %d", NaN (), 33, 44, 55); ASSERT (result != NULL); - ASSERT (strcmp (result, " nan 33") == 0); + ASSERT (strcmp (result, " nan 33") == 0 + || strcmp (result, "0000000nan 33") == 0); ASSERT (length == strlen (result)); free (result); } @@ -724,7 +726,8 @@ char *result = my_asnprintf (NULL, &length, "%010La %d", 1.0L / 0.0L, 33, 44, 55); ASSERT (result != NULL); - ASSERT (strcmp (result, " inf 33") == 0); + ASSERT (strcmp (result, " inf 33") == 0 + || strcmp (result, "0000000inf 33") == 0); ASSERT (length == strlen (result)); free (result); } @@ -734,7 +737,8 @@ char *result = my_asnprintf (NULL, &length, "%010La %d", 0.0L / 0.0L, 33, 44, 55); ASSERT (result != NULL); - ASSERT (strcmp (result, " nan 33") == 0); + ASSERT (strcmp (result, " nan 33") == 0 + || strcmp (result, "0000000nan 33") == 0); ASSERT (length == strlen (result)); free (result); }
--- a/tests/test-vasprintf-posix.c +++ b/tests/test-vasprintf-posix.c @@ -397,7 +397,8 @@ int retval = my_asprintf (&result, "%010a %d", 1.0 / 0.0, 33, 44, 55); ASSERT (result != NULL); - ASSERT (strcmp (result, " inf 33") == 0); + ASSERT (strcmp (result, " inf 33") == 0 + || strcmp (result, "0000000inf 33") == 0); ASSERT (retval == strlen (result)); free (result); } @@ -407,7 +408,8 @@ int retval = my_asprintf (&result, "%010a %d", NaN (), 33, 44, 55); ASSERT (result != NULL); - ASSERT (strcmp (result, " nan 33") == 0); + ASSERT (strcmp (result, " nan 33") == 0 + || strcmp (result, "0000000nan 33") == 0); ASSERT (retval == strlen (result)); free (result); } @@ -705,7 +707,8 @@ int retval = my_asprintf (&result, "%010La %d", 1.0L / 0.0L, 33, 44, 55); ASSERT (result != NULL); - ASSERT (strcmp (result, " inf 33") == 0); + ASSERT (strcmp (result, " inf 33") == 0 + || strcmp (result, "0000000inf 33") == 0); ASSERT (retval == strlen (result)); free (result); } @@ -715,7 +718,8 @@ int retval = my_asprintf (&result, "%010La %d", 0.0L / 0.0L, 33, 44, 55); ASSERT (result != NULL); - ASSERT (strcmp (result, " nan 33") == 0); + ASSERT (strcmp (result, " nan 33") == 0 + || strcmp (result, "0000000nan 33") == 0); ASSERT (retval == strlen (result)); free (result); }