-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
uucore: format: num_format: add fmt
function tests, and workaround 0e10 printing.
#7514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
GNU testsuite comparison:
|
17ba441
to
572e2fe
Compare
GNU testsuite comparison:
|
572e2fe
to
59ada31
Compare
GNU testsuite comparison:
|
59ada31
to
e63adf1
Compare
GNU testsuite comparison:
|
e63adf1
to
e0dd0a8
Compare
GNU testsuite comparison:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds tests for the fmt function in uucore’s number formatting module and introduces a workaround for a BigDecimal printing bug when formatting zero.
- Added tests for fmt covering various cases for floats and integers (scientific, hexadecimal, decimal, signed, and unsigned).
- Introduced a BigDecimal zero workaround in the ExtendedBigDecimal branch to force a 0 value to use scale 0 for printing.
- Updated the spell-checker directive to include "cppreference" in addition to the existing tokens.
Comments suppressed due to low confidence (1)
src/uucore/src/lib/features/format/num_format.rs:249
- Ensure that the workaround for BigDecimal zero formatting properly handles all cases, particularly when force_decimal is enabled. Double-check that returning ExtendedBigDecimal::zero() here does not introduce inconsistencies with the expected output across all formatting functions.
if bd.is_zero() {
e0dd0a8
to
71ee797
Compare
Rebased to fix conflict. |
71ee797
to
8339ee2
Compare
GNU testsuite comparison:
|
This is a bigdecimal issue, see akubera/bigdecimal-rs#144 . Also add a few tests, including a disabled one (our workaround is _before_ the call to format_float_decimal).
All the other tests directly called format_float_* functions, bypassing the additional logic in `fmt` (negative numbers, padding, etc.). This also tests the `parse` function in `mod.rs`, which calls back into `try_from_spec` here. This also makes it easier to test a lot of different format combinations without having to do end-to-end tests in `test_printf.rs`. Also add broken tests for the issues in uutils#7509 and uutils#7510.
8339ee2
to
4cecad3
Compare
akubera/bigdecimal-rs#144 is fixed, but it doesn't hurt to merge this until the next release. Also, this comes with more tests that are good anyway (at least I think so?)... and this is stacked below #7556. |
GNU testsuite comparison:
|
uucore: format: num_format: add
fmt
function testsAll the other tests directly called format_float_* functions,
bypassing the additional logic in
fmt
(negative numbers, padding,etc.).
This also tests the
parse
function inmod.rs
, which calls backinto
try_from_spec
here. This also makes it easier to test a lotof different format combinations without having to do end-to-end
tests in
test_printf.rs
.Also add broken tests for the issues in #7509 and #7510.
uucore: format: Workaround BigDecimal printing bug with 0
This is a bigdecimal issue, see
akubera/bigdecimal-rs#144 .
Also add a few tests, including a disabled one (our workaround
is before the call to format_float_decimal).