diff options
author | Gabriel F. T. Gomes <gabrielftg@linux.ibm.com> | 2019-07-11 11:47:12 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabrielftg@linux.ibm.com> | 2019-11-22 18:12:54 -0300 |
commit | c2f959ed5f244dd4130bcbaab53e0f3ffc49831e (patch) | |
tree | eca425f22b76d96cfa2a3d2e6104d8e3328b2592 /sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c | |
parent | 5bbbd5ae057c8f862e65d9a230bccb2364f48f96 (diff) | |
download | glibc-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-printf-chk-ldbl-compat.c')
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c index d57fd7bc92..55acb890b0 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c +++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c @@ -139,6 +139,10 @@ do_test_call (void) /* Print in hexadecimal notation. */ do_test_call_rarg (stdout, "%.10La, %.10a", ld, d); do_test_call_varg (stdout, "%.10La, %.10a", ld, d); + + /* Test positional parameters. */ + do_test_call_varg (stdout, "%3$Lf, %2$Lf, %1$f", + (double) 1, (long double) 2, (long double) 3); } static int @@ -172,7 +176,13 @@ do_test (void) " __vfprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n" " __vprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n" " __vsnprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n" - " __vsprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n"; + " __vsprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n" + " __vasprintf_chk: 3.000000, 2.000000, 1.000000\n" + " __vdprintf_chk: 3.000000, 2.000000, 1.000000\n" + " __vfprintf_chk: 3.000000, 2.000000, 1.000000\n" + " __vprintf_chk: 3.000000, 2.000000, 1.000000\n" + " __vsnprintf_chk: 3.000000, 2.000000, 1.000000\n" + " __vsprintf_chk: 3.000000, 2.000000, 1.000000\n"; TEST_COMPARE_STRING (expected, result.out.buffer); return 0; |