]> Savannah Git Hosting - gnulib.git/commitdiff
*sprintf tests: Avoid test failures on mingw 10.
authorBruno Haible <bruno@clisp.org>
Mon, 24 Apr 2023 08:57:16 +0000 (10:57 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 24 Apr 2023 08:57:16 +0000 (10:57 +0200)
* 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.

ChangeLog
tests/test-snprintf-posix.h
tests/test-sprintf-posix.h
tests/test-vasnprintf-posix.c
tests/test-vasprintf-posix.c

index 3e54cd4c6fb92e71d34224fabb1cc5d20a05a75b..a048b8806cd0cf3b1466a187babd19e2836e646b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-04-24  Bruno Haible  <bruno@clisp.org>
+
+       *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.
+
 2023-04-23  Bruno Haible  <bruno@clisp.org>
 
        Improve quoting of AS_HELP_STRING's first argument.
index 90fcf61c5affe1e030ebf1c7b5fd808b5c516929..5b81910ec3e34d3a79978cd00545f86316d85193 100644 (file)
@@ -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
index 6ea2052186d1a86e580239b6d783923caa0bcd20..a0b5eb3391636e7792c9f741b552f58eeb528592 100644 (file)
@@ -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
index 9eb042c552623accc61c210935797419ef3e3ed6..51b1d26a337dff16f18fb3570964a4d6989a99ef 100644 (file)
@@ -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
index e4cc0fb9830d63f4b7e13021a43391f7aa1b9d10..858a477a439e7545e1270e826d8c599e7720e31c 100644 (file)
@@ -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