793 Commits

Author SHA1 Message Date
Alexander Grund
d6e3119892
Merge pull request #260 from boostorg/ci
GHA: Stop using Ubuntu 20.04 runner
2025-03-01 15:20:22 +01:00
Alexander Grund
4a9fdb983b Split VS 2019 appveyor job 2025-02-28 09:41:15 +01:00
Alexander Grund
d353abb1d9 Install locale-gen if missing 2025-02-28 09:39:22 +01:00
Alexander Grund
bd9544b301 Update from Boost.CI 2025-02-28 09:33:44 +01:00
Alexander Grund
84c058fd05 GHA: Stop using Ubuntu 20.04 runner 2025-02-28 09:33:29 +01:00
Alexander Grund
c283206426
Merge pull request #257 from boostorg/fuzzing
Add fuzzing of `try_scientific_to_int` to CI
2025-01-17 19:52:24 +01:00
Alexander Grund
bd9eab2870
Fuzzing: Add quoting and dependency on script 2025-01-16 19:51:24 +01:00
Alexander Grund
325da03250
Show input data as string on failure 2025-01-16 19:51:23 +01:00
Alexander Grund
f6dce8fe0c
Fix corpus
Pass absolute paths to corpus.
The corpus needs to be single files with one sample each.
Add a Python script that converts files with multiple samples into
single files.
2025-01-16 19:51:23 +01:00
Alexander Grund
06a8affd2b
Add fuzzing of try_scientific_to_int to CI 2025-01-16 19:51:23 +01:00
Alexander Grund
ba5ff7bf4b
Merge pull request #246 from boostorg/fix-large-number-icu
Implement support for uint64_t values in ICU backend
2025-01-16 19:10:36 +01:00
Alexander Grund
d56bad6d69 Add some tests for missed cases
- Date formatting for UInt64
- Error cases
- Practically unreachable cases
2025-01-16 09:11:08 +01:00
Alexander Grund
86e59b6c03 Reduce verbosity of formatting_common test 2025-01-15 13:57:44 +01:00
Alexander Grund
d03c4ed396 Fix test failure for POSIX formatting when locale is not available
Falls back to C locale where output doesn't match.
2025-01-15 13:57:44 +01:00
Alexander Grund
8019e889c4 Remove left-over condition 2025-01-15 13:57:44 +01:00
Alexander Grund
2a23d33ca0 Avoid copy when parsing ICU number
Instead of filling a temporary buffer we can decompose a number like
"x.yyyEz" to "(x * 10^3 + yyy) * 10^(z - 3)"
I.e. we subtract from the exponent what is required as an exponent to
make the fractional into an integer significant.
For the simple case of "xEz" we just do "x * 10^z".

This requires additional range checks before multiplying but avoids
extra memory accesses.
2025-01-15 13:57:44 +01:00
Alexander Grund
ae0da49613 Avoid corner cases with ICUs scientific format parsing
`boost::charconv::detail::parser` is not made for parsing (large)
integers in exponential notation.
It is mainly tested for parsing floating point numbers in hexadecimal format.

Given we know ICU will output either an integer string or a number in
"E notation" (1.2E2) we can convert that rather easily to a "regular"
integer string by "moving" the dot to the right according to the
exponent. The trailing gap is filled with zeros before passing it to
`from_chars` which is now able to handle the range checks for us.

This avoids overflows that can happen when multiplying the
significant by the exponent which, due to integer arithmetic, would be
cumbersome to guard against.

Any situation that could yield a fractional or a too large value can be caught early.
2025-01-15 13:57:44 +01:00
Alexander Grund
3536525cff Handle ICU version that keep parsed number in scientific format
ICU might return 9223372036854775810 as 9.22337203685477581E+18
Use the internal parser of Boost.Charconv to handle this.
2025-01-15 13:57:44 +01:00
Alexander Grund
42e65d0d3d Implement support for uint64_t values in ICU backend
ICU doesn't support uint64_t directly but provides access to formatting
and parsing of decimal number strings.
Use Boost.Charconv to interface with that.

Fixes #235
2025-01-15 13:57:44 +01:00
Alexander Grund
211734c2c8 Add test for formatting large (u)int64 numbers
As reported in #235 formatting the first number which doesn't fit into
int64_t anymore fails to add the thousands separators.
I.e.:
`9223372036854775807` -> `9,223,372,036,854,775,807`
`9223372036854775808` -> `9223372036854775808`

Add a test reproducing that that for all backends.
2025-01-15 13:57:44 +01:00
Alexander Grund
b017126235 GHA: Show output of all runs of binaries in test folder 2025-01-15 13:57:44 +01:00
Alexander Grund
5f24abe113
Fix returning false from TEST macro 2025-01-12 18:59:11 +01:00
Alexander Grund
6c890c1661
Merge pull request #252 from boostorg/refactor
Refactor for speed and consistency
2025-01-11 12:13:48 +01:00
Alexander Grund
e540a63c0b Enable char8_t strings where available, remove Clang condition
The issue was caused by using an incompatible libstdc++.
For Clang 13 & 14 libstdc++ 11 works.
2025-01-10 13:33:10 +01:00
Alexander Grund
c2147f6486 Switch to boost::core::string_view
This is compatible to `std::string_view` and also to `boost::string_view`
so hence the better option.
2025-01-10 13:33:09 +01:00
Alexander Grund
ac069b6096 Fix handling of + prefix in try_to_int 2025-01-10 13:33:09 +01:00
Alexander Grund
e8f9544352 Replace some TEST_REQUIRE by if TEST 2025-01-10 13:33:08 +01:00
Alexander Grund
1abbbb3d6d Allow to check success of TEST macro at call site.
Useful if next check(s) depend on previous ones.
2025-01-10 13:33:08 +01:00
Alexander Grund
8cc6f42fd4 Make try_to_int a template 2025-01-10 13:33:07 +01:00
Alexander Grund
258e959402 Use Boost::charconv for try_to_int 2025-01-10 13:33:05 +01:00
Alexander Grund
b919614216 Move try_to_int to extra header 2025-01-10 13:33:03 +01:00
Alexander Grund
f57605e8dc Avoid superflous copy of time zone string 2025-01-10 12:51:47 +01:00
Alexander Grund
6826cca159 Consistently pass string_view by value 2025-01-10 12:51:47 +01:00
Alexander Grund
5a58e65bda Remove superflous subfolders of src
The shorter paths make the sources easier to navigate.

Basically revert of #99 / f44b3bb771f01fb94614260d57e1d09cdfe1cdff
after the underlying issue is resolved.
2025-01-10 12:50:45 +01:00
Alexander Grund
abd3b983b8
Merge pull request #254 from boostorg/gha-packages
GHA update
2025-01-09 19:15:28 +01:00
Alexander Grund
806fc4351a Avoid missing coverage
Recompiling with different options/defines might remove covered lines
that no longer exist.
This is e.g. the case for the IConv code paths when compiling with ICU
and without IConv in the last test run before collecting the coverage
data.

To avoid this collect coverage data after each test run into separate
files and upload all of them.
2025-01-09 09:47:11 +01:00
Alexander Grund
219dff1584 GHA: Install 32bit ICU if compiling for 32bit 2025-01-09 09:44:13 +01:00
Alexander Grund
676ba05b82 Show output of config step and tests in GHA CI 2025-01-09 09:44:13 +01:00
Alexander Grund
1bb178a507 GHA: Use libstdc++-11 for Clang 13/14
They are not yet compatible with libstdc++-12 and up.
2025-01-09 09:44:13 +01:00
Alexander Grund
f00d128633 GHA: Remove ubuntu-toolchain ppa 2025-01-09 09:44:13 +01:00
Alexander Grund
d20388d31b Update coverage step
- Use new "collect" argument
- Fail CI on error
2025-01-09 09:44:13 +01:00
Alexander Grund
b1cf7585d4
GHA: Fix parameter for codecov action 2025-01-07 20:05:46 +01:00
Alexander Grund
843fdc9157 Replace (semi-)absolute includes to implementation headers by relative ones
Makes it easier to see the distinction, especially for tools.
2025-01-04 20:55:49 +01:00
Alexander Grund
9e6e9545c6
GHA: Uprev codecov action to v5 2024-12-28 10:42:51 +01:00
Alexander Grund
fe1373e230
Merge pull request #251 from boostorg/ICU-upgrade
Raise minimum ICU version to 4.8.1 and exclude 50.1
2024-12-28 04:10:05 +01:00
Alexander Grund
ec1676280e
Raise minimum ICU version to 4.8.1
A lot of checks and a major workaround are for ICU 4.8 or earlier which
can be removed.
An annoying bug (Parsing of timezones like "GMT" in "full" format followed by unrelated text)
fixed in 4.8.1 is worth avoiding by requiring this version over 4.8.0.
2024-12-27 12:14:43 +01:00
Alexander Grund
34611eadae
Raise minimum ICU version to 4.2
StringPiece is only available in 4.2+ and is required for proper parsing
and formatting.
As this version is now "old enough", just assume 4.2+ removing many
conditionals.
2024-12-27 12:14:43 +01:00
Alexander Grund
bbfb763a98
Exclude ICU 50.1
This version has a regression with Integer parsing.
See https://unicode-org.atlassian.net/browse/ICU-9780
2024-12-27 12:14:43 +01:00
Alexander Grund
791d7a1492
Build: Make SOURCES variables local 2024-12-27 12:14:26 +01:00
Alexander Grund
ea76606d36 Reduce number of C++11 compiler checks
Speed up the configuration step:
- defaulted moves implies defaulted functions and rvalues
  -> Clang 3.0, MSVC 19.0/2015
  -> decltype, noexcept, auto & variadic templates also available in all compilers that support those
- override requires GCC 4.7+
- hdr type_traits implies hdr functional for all known stdlibs
2024-12-27 12:13:10 +01:00