This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix up long double fphex test


This patch fixes the test for non ldbl-96 targets.  Now it should pass
on ldbl-128, ldbl-129ibm and dbl-64 targets too.
Regtested on x86_64-redhat-linux and ppc64-redhat-linux with both 
-mlong-double-{128,64}, ok for trunk?

2012-03-07  Marek Polacek  <polacek@redhat.com>

	* stdio-common/tst-long-dbl-fphex.c: Fix test for non ldbl-96 targets.

--- libc/stdio-common/tst-long-dbl-fphex.c.mp	2012-03-07 18:46:17.662878532 +0100
+++ libc/stdio-common/tst-long-dbl-fphex.c	2012-03-07 19:46:53.199177136 +0100
@@ -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);
+  /* 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 ()
	
	Marek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]