diff options
| author | Pádraig Brady <P@draigBrady.com> | 2025-10-14 21:06:03 +0100 |
|---|---|---|
| committer | Pádraig Brady <P@draigBrady.com> | 2025-10-17 17:26:30 +0100 |
| commit | 006dfe4cd4dfc2c31ee4a21b6754dbbeb99ef407 (patch) | |
| tree | 1a04ac793e8dfe9c3118ffdeda10bba0e0f3dba9 /tests | |
| parent | numfmt: support reading numbers with NBSP before unit (diff) | |
| download | coreutils-006dfe4cd4dfc2c31ee4a21b6754dbbeb99ef407.tar.gz coreutils-006dfe4cd4dfc2c31ee4a21b6754dbbeb99ef407.zip | |
numfmt: support reading numbers with grouping characters
This does not validate grouping character placement,
and currently just ignores grouping characters.
* src/numfmt.c (simple_strtod_int): Skip grouping chars
that are part of a number.
* tests/misc/numfmt.pl: Add test cases.
* NEWS: Mention the improvement.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/misc/numfmt.pl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/misc/numfmt.pl b/tests/misc/numfmt.pl index 85c888cd8..1d3c4202c 100755 --- a/tests/misc/numfmt.pl +++ b/tests/misc/numfmt.pl @@ -1050,8 +1050,20 @@ my @Locale_Tests = {OUT=>"7${lg}000${lg}000"}, {ENV=>"LC_ALL=$locale"}], - # Input with locale'd decimal-point - ['lcl-stdtod-1', '--from=si 12,2K', {OUT=>"12200"}, + # Input with locale's grouping + ['lcl-strtod-1', '--from=si 1${lg}234K', {OUT=>"1234000"}, + {ENV=>"LC_ALL=$locale"}], + + # Input with locale's grouping. Note position not validated. + ['lcl-strtod-2', '--from=si 12${lg}34K', {OUT=>"1234000"}, + {ENV=>"LC_ALL=$locale"}], + + # Input with locale's decimal-point + ['lcl-strtod-3', '--from=si 12,2K', {OUT=>"12200"}, + {ENV=>"LC_ALL=$locale"}], + + # Input with locale's grouping and decimal-point + ['lcl-strtod-4', '--from=si 1${lg}23,4K', {OUT=>"123400"}, {ENV=>"LC_ALL=$locale"}], ['lcl-dbl-to-human-1', '--to=si 1100', {OUT=>"1,1k"}, |
