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
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.
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.
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.
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.
Try to achieve 100% test code coverage to find accidentally missed ones.
Especially the WinAPI tests had some wrongly uncovered lines at function
start/end which needed to be excluded.
Especially the ICU backend falls back to using `std::numpunct` so need
to be sure POSIX formatting and number formatting works as expected when
changing that.
ICU changed the time format again (in the CLDR) using a NBSP before AM/PM instead of a real space.
Hence query ICU directly for the expected result.
But also use a hard-coded value for parsing tests to ensure backwards compatibility.
Define `_SCL_SECURE_NO_WARNINGS` for building the library to avoid "Call to 'std::copy' with parameters that may be unsafe" in `src\boost\locale\std\converter.cpp`
This also allows to remove the multiple suppressions of C4996
Move the skip condition into `test_main` to avoid missing compile failures due to wrong/missing includes in the headers and to improve formatting due to the removed indentation level of the PP macros
The `dynamic_cast` of ICU classes may fail with libc++ due to
missing/wrong RTTI and their `U_IMPORT`. I.e. it may duplicate the RTTI
for e.g. `SimpleDateFormat` making the cast fail.
Introduce `icu_cast` to handle that.
Especially the `get_icu_currency_iso` was reevaluated multiple times for each subtest which is redundant.
So modify the macros to store the value as a `const std::string` evaluating it exactly once.
Gets rid of the `test_` prefix in the filenames and avoids confusing those with the actual tests especially by renaming the test framework file from `test_locale.hpp` to `unit_test.hpp`
Use a common `main` function calling into custom `test_main` functions and
move all common code into the former.
Also introduce an RAII class for a `locale_t` to avoid leaks and reduce
the code further.
Add some LCOV annotations for lines not expected to be reached.