]> Savannah Git Hosting - gnulib.git/commitdiff
vasnprintf tests: Avoid test failure on Cygwin.
authorBruno Haible <bruno@clisp.org>
Tue, 2 Oct 2018 08:50:42 +0000 (10:50 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 2 Oct 2018 08:50:42 +0000 (10:50 +0200)
* tests/test-vasnprintf.c (test_function): Change the test added on
2018-09-23 to check only the 42 most significant digits.

ChangeLog
tests/test-vasnprintf.c

index 097f7ded4db0029970a082bc6112d28c3fbd73b9..e0993f7dbbb23444245c45fcf0cb7b3444f1650c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-10-02  Bruno Haible  <bruno@clisp.org>
+
+       vasnprintf tests: Avoid test failure on Cygwin.
+       * tests/test-vasnprintf.c (test_function): Change the test added on
+       2018-09-23 to check only the 42 most significant digits.
+
 2018-10-01  Bruno Haible  <bruno@clisp.org>
 
        mkostemp, mkostemps: Update documentation.
index 93d81d7041c58a5384d7ca06c0917ab70bc1509b..0cd17f98678f0771dfb0ea0424e208186b7ede42 100644 (file)
@@ -70,7 +70,13 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
       length = size;
       result = my_asnprintf (buf, &length, "%2.0f", 1.6314159265358979e+125);
       ASSERT (result != NULL);
-      ASSERT (strcmp (result, "163141592653589790215729350939528493057529598899734151772468186268423257777068536614838678161083520756952076273094236944990208") == 0);
+      /* The exact result and the result on glibc systems is
+         163141592653589790215729350939528493057529598899734151772468186268423257777068536614838678161083520756952076273094236944990208
+         On Cygwin, the result is
+         163141592653589790215729350939528493057529600000000000000000000000000000000000000000000000000000000000000000000000000000000000
+       */
+      ASSERT (strlen (result) == 126);
+      ASSERT (memcmp (result, "163141592653589790215729350939528493057529", 42) == 0);
       ASSERT (length == 126);
       if (size < 126 + 1)
         ASSERT (result != buf);