about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-ldbl-compat.c
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabrielftg@linux.ibm.com>2019-07-11 11:47:12 -0300
committerGabriel F. T. Gomes <gabrielftg@linux.ibm.com>2019-11-22 18:12:54 -0300
commitc2f959ed5f244dd4130bcbaab53e0f3ffc49831e (patch)
treeeca425f22b76d96cfa2a3d2e6104d8e3328b2592 /sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-ldbl-compat.c
parent5bbbd5ae057c8f862e65d9a230bccb2364f48f96 (diff)
downloadglibc-c2f959ed5f244dd4130bcbaab53e0f3ffc49831e.tar.gz
glibc-c2f959ed5f244dd4130bcbaab53e0f3ffc49831e.tar.xz
glibc-c2f959ed5f244dd4130bcbaab53e0f3ffc49831e.zip
ldbl-128ibm-compat: Test positional arguments
The format string can request positional parameters, instead of relying
on the order in which they appear as arguments.  Since this has an
effect on how the type of each argument is determined, this patch
extends the test cases to use positional parameters with mixed double
and long double types, to verify that the IEEE long double
implementations of *printf work correctly in this scenario.

Tested for powerpc64le.

Reviewed-By: Paul E. Murphy <murphyp@linux.ibm.com>
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-ldbl-compat.c')
-rw-r--r--sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-ldbl-compat.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-ldbl-compat.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-ldbl-compat.c
index def4337571..008275f529 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-ldbl-compat.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-ldbl-compat.c
@@ -83,6 +83,10 @@ do_test_call (void)
   /* Print in hexadecimal notation.  */
   do_test_call_rarg (stdout, L"%.10La, %.10a", ld, d);
   do_test_call_varg (stdout, L"%.10La, %.10a", ld, d);
+
+  /* Test positional parameters.  */
+  do_test_call_varg (stdout, L"%3$Lf, %2$Lf, %1$f",
+		     (double) 1, (long double) 2, (long double) 3);
 }
 
 static int
@@ -104,7 +108,10 @@ do_test (void)
     "      wprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n"
     "    vfwprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n"
     "    vswprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n"
-    "     vwprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n";
+    "     vwprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n"
+    "    vfwprintf: 3.000000, 2.000000, 1.000000\n"
+    "    vswprintf: 3.000000, 2.000000, 1.000000\n"
+    "     vwprintf: 3.000000, 2.000000, 1.000000\n";
   TEST_COMPARE_STRING (expected, result.out.buffer);
 
   return 0;