about summary refs log tree commit diff
path: root/stdio-common/tst-long-dbl-fphex.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2012-03-08 02:46:43 -0500
committerUlrich Drepper <drepper@gmail.com>2012-03-08 02:46:43 -0500
commit70bca0a394a2135927210007f1dd6eceafe1aaf5 (patch)
treefd2d49cdbc9425032d506fe2d0d6002fd4385d75 /stdio-common/tst-long-dbl-fphex.c
parent67c6a3d919b492c68664c4b95e84efd2174309e7 (diff)
downloadglibc-70bca0a394a2135927210007f1dd6eceafe1aaf5.tar.gz
glibc-70bca0a394a2135927210007f1dd6eceafe1aaf5.tar.xz
glibc-70bca0a394a2135927210007f1dd6eceafe1aaf5.zip
Fix up long double fphex test
Diffstat (limited to 'stdio-common/tst-long-dbl-fphex.c')
-rw-r--r--stdio-common/tst-long-dbl-fphex.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/stdio-common/tst-long-dbl-fphex.c b/stdio-common/tst-long-dbl-fphex.c
index b57fb85ad7..d879c98e88 100644
--- a/stdio-common/tst-long-dbl-fphex.c
+++ b/stdio-common/tst-long-dbl-fphex.c
@@ -24,14 +24,29 @@ static int do_test (void);
 static int
 do_test (void)
 {
+#ifndef NO_LONG_DOUBLE
+  int result = 0;
   const long double x = 24.5;
-  wchar_t a[16 * sizeof (wchar_t)];
-  swprintf (a, 16 * sizeof (wchar_t), L"%La\n", x);
-  wchar_t A[16 * sizeof (wchar_t)];
-  swprintf (A, 16 * sizeof (wchar_t), L"%LA\n", x);
-
-  return (wmemcmp (a, L"0xc.4p+1", 8) != 0
-	  || wmemcmp (A, L"0XC.4P+1", 8) != 0);
+  wchar_t a[16];
+  swprintf (a, sizeof (a), L"%La\n", x);
+  wchar_t A[16];
+  swprintf (A, sizeof (A) / sizeof (A[0]), L"%LA\n", x);
+
+  /* Here wprintf can return four valid variants.  We must accept all
+     of them.  */
+  result |= (wmemcmp (a, L"0xc.4p+1", 8) == 0
+	     && wmemcmp (A, L"0XC.4P+1", 8) == 0);
+  result |= (wmemcmp (a, L"0x3.1p+3", 8) == 0
+	     && wmemcmp (A, L"0X3.1P+3", 8) == 0);
+  result |= (wmemcmp (a, L"0x6.2p+2", 8) == 0
+	     && wmemcmp (A, L"0X6.2P+2", 8) == 0);
+  result |= (wmemcmp (a, L"0x1.88p+4", 8) == 0
+	     && wmemcmp (A, L"0X1.88P+4", 8) == 0);
+
+  return result != 1;
+#else
+  return 0;
+#endif
 }
 
 #define TEST_FUNCTION do_test ()