[go: up one dir, main page]

Mentions légales du service

Skip to content
Commits on Source (1)
  • Vincent Lefèvre's avatar
    [tests/tsprintf.c] Modified a buggy test of the thousands separator. · 5a1b1f9a
    Vincent Lefèvre authored
    The test
    
      check_vsprintf ("+01,234,567  :", "%0+ -'13.10Pd:", (mpfr_prec_t) 1234567);
    
    is based on the output from glibc up to 2.36, which is incorrect:
    
      https://sourceware.org/bugzilla/show_bug.cgi?id=23432
    
    The GNU C Library has apparently been partially fixed in its Git
    repository for the future 2.37, since a tsprintf failure has been
    reported (this is a bug in this test, not in the MPFR library):
    
      https://sympa.inria.fr/sympa/arc/mpfr/2023-01/msg00001.html
    
    So, modified the test to avoid the particular case of leading zeros
    due to the precision field larger than the number of digits. This
    case has already been tested without the thousands separator (where
    there are no issues with the C libraries), so that we do not miss
    much testing. Added a comment explaining the issue and a possible
    solution for future testing of this particular case (if need be).
    
    (cherry picked from commit 5172494c)
    5a1b1f9a
......@@ -1706,7 +1706,17 @@ test_locale (void)
check_sprintf ("000000001,000", "%'013.4Rg", x);
#ifdef PRINTF_GROUPFLAG
check_vsprintf ("+01,234,567 :", "%0+ -'13.10Pd:", (mpfr_prec_t) 1234567);
/* Do not test the thousands separator with a precision field larger
than the number of digits (thus needing leading zeros), such as
"%0+ -'13.10Pd:" (used up to MPFR 4.2.0), since the GNU libc is
buggy: https://sourceware.org/bugzilla/show_bug.cgi?id=23432
We don't know about the other implementations.
If we wanted to check that and avoid a failure of the test because of
a buggy C library (while MPFR would be consistent with the C library),
we could compare the MPFR output with both the correct output and the
output from the C library (possibly buggy). But to do that in a clean
way, this would require a change in the check_vsprintf() call. */
check_vsprintf ("+1,234,567 :", "%0+ -'13Pd:", (mpfr_prec_t) 1234567);
#endif
mpfr_clear (x);
......