diff options
author | ngie <ngie@FreeBSD.org> | 2017-02-14 04:47:13 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-02-14 04:47:13 +0000 |
commit | 4654a3e4a6c0b5420141ad6f14b579d1c80278ee (patch) | |
tree | ebce1406d9ad5620dbe67a6612b692c0b895e958 /lib/libc | |
parent | 2db56beee1ae7ba1d122f40eaa47a7bbd8f14aa5 (diff) | |
download | FreeBSD-src-4654a3e4a6c0b5420141ad6f14b579d1c80278ee.zip FreeBSD-src-4654a3e4a6c0b5420141ad6f14b579d1c80278ee.tar.gz |
MFC r313376:
Fix :hexadecimal_floating_point on i386
Don't exclude i386 from LDBL_MANT_DIG == 64; it works properly in
that case.
While here, replace strcmp + atf_tc_fail with ATF_CHECK_MSG for 2
reasons:
- Gather as many results as possible instead of failing early and
not testing the rest of the cases.
- Simplify logic when checking test inputs vs outputs and printing
test result.
Tested on: amd64, i386
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/tests/stdio/printfloat_test.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/libc/tests/stdio/printfloat_test.c b/lib/libc/tests/stdio/printfloat_test.c index 974374f..97629fb 100644 --- a/lib/libc/tests/stdio/printfloat_test.c +++ b/lib/libc/tests/stdio/printfloat_test.c @@ -70,22 +70,19 @@ _testfmt(const char *result, const char *argstr, const char *fmt,...) va_copy(ap2, ap); smash_stack(); vsnprintf(s, sizeof(s), fmt, ap); - if (strcmp(result, s) != 0) { - atf_tc_fail( - "printf(\"%s\", %s) ==> [%s], expected [%s]", - fmt, argstr, s, result); - } + ATF_CHECK_MSG(strcmp(result, s) == 0, + "printf(\"%s\", %s) ==> [%s], expected [%s]", + fmt, argstr, s, result); smash_stack(); mbstowcs(ws, s, BUF - 1); mbstowcs(wfmt, fmt, BUF - 1); mbstowcs(wresult, result, BUF - 1); vswprintf(ws, sizeof(ws) / sizeof(ws[0]), wfmt, ap2); - if (wcscmp(wresult, ws) != 0) { - atf_tc_fail( - "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]", - wfmt, argstr, ws, wresult); - } + ATF_CHECK_MSG(wcscmp(wresult, ws) == 0, + "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]", + wfmt, argstr, ws, wresult); + va_end(ap); va_end(ap2); } @@ -318,7 +315,7 @@ ATF_TC_BODY(hexadecimal_floating_point, tc) testfmt("0x1p-1074", "%a", 0x1p-1074); testfmt("0x1.2345p-1024", "%a", 0x1.2345p-1024); -#if (LDBL_MANT_DIG == 64) && !defined(__i386__) +#if (LDBL_MANT_DIG == 64) testfmt("0x1.921fb54442d18468p+1", "%La", 0x3.243f6a8885a308dp0L); testfmt("0x1p-16445", "%La", 0x1p-16445L); testfmt("0x1.30ecap-16381", "%La", 0x9.8765p-16384L); |