Skip to content
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

Fix parsing of numbers in floating point format to integers #241

Merged
merged 3 commits into from
Nov 17, 2024

Conversation

Flamefire
Copy link
Collaborator

When parsing a string like "123.456" to an integer the ICU backend would first parse it greedily to a floating point value and then cast/truncate it to an integer.
Set the flag to only parse integers when parsing to an integral number. Care must be taken not to set that when parsing e.g. a currency or date to an integer where the truncation is intended.

When parsing a string like "123.456" to an integer the ICU backend would
first parse it greedily to a floating point value and then cast/truncate
it to an integer.
Set the flag to only parse integers when parsing to an integral number.
Care must be taken not to set that when parsing e.g. a currency or date
to an integer where the truncation is intended.
The Drone CI fails because the en_US.UTF-8 `locale_t` does not have a
grouping and thousand separator so "12,345" fails to parse.
Format instead to have the expected format as input.
Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.81%. Comparing base (ff91706) to head (1e9e855).
Report is 4 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #241      +/-   ##
===========================================
+ Coverage    95.76%   95.81%   +0.05%     
===========================================
  Files          116      117       +1     
  Lines        10035    10353     +318     
===========================================
+ Hits          9610     9920     +310     
- Misses         425      433       +8     
Files with missing lines Coverage Δ
src/boost/locale/icu/formatter.cpp 79.02% <100.00%> (+0.31%) ⬆️
test/formatting_common.hpp 100.00% <100.00%> (ø)
test/test_formatting.cpp 100.00% <100.00%> (ø)
test/test_posix_formatting.cpp 100.00% <100.00%> (ø)
test/test_std_formatting.cpp 100.00% <100.00%> (ø)
test/test_winapi_formatting.cpp 100.00% <100.00%> (ø)

... and 55 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff91706...1e9e855. Read the comment docs.

@Flamefire Flamefire merged commit 25ba76d into boostorg:develop Nov 17, 2024
49 checks passed
@Flamefire Flamefire deleted the multi-parse branch November 17, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant