Mercurial > gnulib
comparison tests/test-vasnprintf.c @ 39878:4af9ded9afba
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.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 02 Oct 2018 10:50:42 +0200 |
parents | 97ddb1ab5d88 |
children | 23fe4d342f8b |
comparison
equal
deleted
inserted
replaced
39877:a8509dc053f1 | 39878:4af9ded9afba |
---|---|
68 | 68 |
69 memcpy (buf, "DEADBEEF", 8); | 69 memcpy (buf, "DEADBEEF", 8); |
70 length = size; | 70 length = size; |
71 result = my_asnprintf (buf, &length, "%2.0f", 1.6314159265358979e+125); | 71 result = my_asnprintf (buf, &length, "%2.0f", 1.6314159265358979e+125); |
72 ASSERT (result != NULL); | 72 ASSERT (result != NULL); |
73 ASSERT (strcmp (result, "163141592653589790215729350939528493057529598899734151772468186268423257777068536614838678161083520756952076273094236944990208") == 0); | 73 /* The exact result and the result on glibc systems is |
74 163141592653589790215729350939528493057529598899734151772468186268423257777068536614838678161083520756952076273094236944990208 | |
75 On Cygwin, the result is | |
76 163141592653589790215729350939528493057529600000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
77 */ | |
78 ASSERT (strlen (result) == 126); | |
79 ASSERT (memcmp (result, "163141592653589790215729350939528493057529", 42) == 0); | |
74 ASSERT (length == 126); | 80 ASSERT (length == 126); |
75 if (size < 126 + 1) | 81 if (size < 126 + 1) |
76 ASSERT (result != buf); | 82 ASSERT (result != buf); |
77 ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); | 83 ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); |
78 if (result != buf) | 84 if (result != buf) |