From ebdce3b64e3ff04daafb742fde8823de4b6ce80f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 24 Apr 2023 10:57:16 +0200 Subject: *sprintf tests: Avoid test failures on mingw 10. * tests/test-vasnprintf-posix.c (test_function): On newer mingw, expect the de-facto standard result. * tests/test-vasprintf-posix.c (test_function): Likewise. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-sprintf-posix.h (test_function): Likewise. --- tests/test-snprintf-posix.h | 6 ++++-- tests/test-sprintf-posix.h | 6 ++++-- tests/test-vasnprintf-posix.c | 6 ++++-- tests/test-vasprintf-posix.c | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/test-snprintf-posix.h b/tests/test-snprintf-posix.h index 90fcf61c5a..5b81910ec3 100644 --- a/tests/test-snprintf-posix.h +++ b/tests/test-snprintf-posix.h @@ -3190,7 +3190,8 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...)) /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a width and a precision are both present. But most implementations do so. */ #ifdef __MINGW32__ - ASSERT (strcmp (result, "00000000000303c 33") == 0); + ASSERT (strcmp (result, "00000000000303c 33") == 0 /* mingw 5 */ + || strcmp (result, " 000000303c 33") == 0 /* mingw 10 */); #else ASSERT (strcmp (result, " 000000303c 33") == 0); #endif @@ -3252,7 +3253,8 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...)) /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a width and a precision are both present. But most implementations do so. */ #ifdef __MINGW32__ - ASSERT (strcmp (result, "0x000000000303c 33") == 0); + ASSERT (strcmp (result, "0x000000000303c 33") == 0 /* mingw 5 */ + || strcmp (result, " 0x000000303c 33") == 0 /* mingw 10 */); #else ASSERT (strcmp (result, " 0x000000303c 33") == 0); #endif diff --git a/tests/test-sprintf-posix.h b/tests/test-sprintf-posix.h index 6ea2052186..a0b5eb3391 100644 --- a/tests/test-sprintf-posix.h +++ b/tests/test-sprintf-posix.h @@ -3166,7 +3166,8 @@ test_function (int (*my_sprintf) (char *, const char *, ...)) /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a width and a precision are both present. But most implementations do so. */ #ifdef __MINGW32__ - ASSERT (strcmp (result, "00000000000303c 33") == 0); + ASSERT (strcmp (result, "00000000000303c 33") == 0 /* mingw 5 */ + || strcmp (result, " 000000303c 33") == 0 /* mingw 10 */); #else ASSERT (strcmp (result, " 000000303c 33") == 0); #endif @@ -3228,7 +3229,8 @@ test_function (int (*my_sprintf) (char *, const char *, ...)) /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a width and a precision are both present. But most implementations do so. */ #ifdef __MINGW32__ - ASSERT (strcmp (result, "0x000000000303c 33") == 0); + ASSERT (strcmp (result, "0x000000000303c 33") == 0 /* mingw 5 */ + || strcmp (result, " 0x000000303c 33") == 0 /* mingw 10 */); #else ASSERT (strcmp (result, " 0x000000303c 33") == 0); #endif diff --git a/tests/test-vasnprintf-posix.c b/tests/test-vasnprintf-posix.c index 9eb042c552..51b1d26a33 100644 --- a/tests/test-vasnprintf-posix.c +++ b/tests/test-vasnprintf-posix.c @@ -4148,7 +4148,8 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a width and a precision are both present. But most implementations do so. */ #ifdef __MINGW32__ - ASSERT (strcmp (result, "00000000000303c 33") == 0); + ASSERT (strcmp (result, "00000000000303c 33") == 0 /* mingw 5 */ + || strcmp (result, " 000000303c 33") == 0 /* mingw 10 */); #else ASSERT (strcmp (result, " 000000303c 33") == 0); #endif @@ -4234,7 +4235,8 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a width and a precision are both present. But most implementations do so. */ #ifdef __MINGW32__ - ASSERT (strcmp (result, "0x000000000303c 33") == 0); + ASSERT (strcmp (result, "0x000000000303c 33") == 0 /* mingw 5 */ + || strcmp (result, " 0x000000303c 33") == 0 /* mingw 10 */); #else ASSERT (strcmp (result, " 0x000000303c 33") == 0); #endif diff --git a/tests/test-vasprintf-posix.c b/tests/test-vasprintf-posix.c index e4cc0fb983..858a477a43 100644 --- a/tests/test-vasprintf-posix.c +++ b/tests/test-vasprintf-posix.c @@ -4089,7 +4089,8 @@ test_function (int (*my_asprintf) (char **, const char *, ...)) /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a width and a precision are both present. But most implementations do so. */ #ifdef __MINGW32__ - ASSERT (strcmp (result, "00000000000303c 33") == 0); + ASSERT (strcmp (result, "00000000000303c 33") == 0 /* mingw 5 */ + || strcmp (result, " 000000303c 33") == 0 /* mingw 10 */); #else ASSERT (strcmp (result, " 000000303c 33") == 0); #endif @@ -4175,7 +4176,8 @@ test_function (int (*my_asprintf) (char **, const char *, ...)) /* Neither ISO C nor POSIX specify that the '0' flag is ignored when a width and a precision are both present. But most implementations do so. */ #ifdef __MINGW32__ - ASSERT (strcmp (result, "0x000000000303c 33") == 0); + ASSERT (strcmp (result, "0x000000000303c 33") == 0 /* mingw 5 */ + || strcmp (result, " 0x000000303c 33") == 0 /* mingw 10 */); #else ASSERT (strcmp (result, " 0x000000303c 33") == 0); #endif -- cgit v1.2.1