5 Commits

Author SHA1 Message Date
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
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
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
b919614216 Move try_to_int to extra header 2025-01-10 13:33:03 +01:00