2
0
mirror of https://github.com/boostorg/locale.git synced 2026-01-24 06:02:07 +00:00

32 Commits

Author SHA1 Message Date
Alexander Grund
a6beef1a36 Test value only after successful parsing
Avoid subsequent failure reports if the parsing already failed
2025-10-25 17:44:27 +02: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
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
e8f9544352 Replace some TEST_REQUIRE by if TEST 2025-01-10 13:33:08 +01:00
Alexander Grund
9a346dd5f8 Fix parsing of numbers in floating point format to integers
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.
2024-11-11 15:48:24 +01:00
Alexander Grund
26469cd230 Suppress or handle missing coverage of test code
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.
2023-06-27 23:04:08 +02:00
Alexander Grund
cfa4a3ea7a Refactor date/time part of test_*_formatting
Instead of doing a combined formatting and comparison of many format
parts (`as::date`, `as::time` & `as::datetime`) test each one
individually to be able to spot issues easier when it fails
2023-05-26 19:35:36 +02:00
Alexander Grund
9b1813e757 Remove superflous braces
Make the code a bit shorter vertically, enforced formating ensures
correct indentation which provides enough readability
2023-05-16 12:04:59 +02:00
Alexander Grund
0a68c52b7f Modernize using nullptr 2023-05-07 19:01:45 +02:00
Alexander Grund
3d29a20322 Refactor: Make (better) use of have_locale and rename to has_posix_locale 2023-03-01 17:10:28 +01:00
Alexander Grund
3609eca8b2 Make use of enhanced test macros
Use the TEST-macros that print the values on mismatch to aid debugging
2023-01-10 14:45:07 +01:00
Alexander Grund
1cc2a017ab Fix some MSVC warnings
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
2022-11-22 09:15:17 +01:00
Alexander Grund
f198558ab9 Improve checks in formatting tests
Call `TEST` on the input/output operation of the stream instead of on
the stream afterwards to improve output in case of failure.
2022-11-21 20:19:16 +01:00
Alexander Grund
668f2277cc Factor out str_end function for getting the end of a C-String 2022-10-22 18:42:51 +02:00
Alexander Grund
b8a3c3cb53 Refactor tests and remove/combine/handle special cases for some ICU versions in tests 2022-10-13 20:58:25 +02:00
Alexander Grund
907e62517f Always compile all test cases
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
2022-10-10 14:25:58 +02:00
Alexander Grund
fa4afd7a5d Switch to consistent west-const
Especially for `const char*` which seems to be more common than `char const*`
2022-10-10 14:25:58 +02:00
Alexander Grund
7784f46243 Format sources
Use clang-format-14 to format source code consistently.
Closes #98
2022-10-10 14:25:58 +02:00
Alexander Grund
b6240532ec Refactor tests using locale names
Unify the tests a bit so it is easier to find the used locales
2022-09-16 23:28:26 +02:00
Alexander Grund
fadb2190ce Move test headers to subfolder
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`
2022-09-13 12:50:23 +02:00
Alexander Grund
a5bf5e8538 Remove usage of cassert
Replace by BOOST_ASSERT or test macros
2022-07-12 18:35:43 +02:00
Alexander Grund
707f801c55 Remive vim markers
To be replaced by clang-format in the future.
2022-07-12 18:35:42 +02:00
Alexander Grund
595934f25e Update license headers
Use the more concise format omitting the reference to the license file
and refer to the URL only.
2022-07-12 18:35:41 +02:00
Alexander Grund
aa30bd33aa Refactor test framework
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.
2022-06-30 15:08:08 +02:00
Alexander Grund
8c7338cd0d Use \n instead of std::endl where appropriate
We usually don't need the flush so use \n at end of strings which
greatly shortens the code.
2022-06-30 15:08:08 +02:00
Alexander Grund
00c8e07689 Remove using std-namespace and reformat
Removes the `using namespace std` to easier differentiate between
Boost.Locale and Std stuff.
Add spaces around shift operators.
2022-06-30 15:08:08 +02:00
Alexander Grund
d1fc12426f Remove trailing spaces 2022-06-04 11:50:39 +02:00
Alexander Grund
f3fa220608 Fix includes and unify include style
For consistency the following rules are used:
- public includes (include folder) either include any <boost/locale/*>
  first. At least <boost/locale/config.hpp>
- The first include in a cpp file is the corresponding header if any
- Then <boost/locale/*>, <boost/*>, <*>, "*" in this order
- Warning suppression pragmas come last where possible
- Use the C++ headers where available (i.e. <cstring> not <string.h>)
2022-05-29 22:20:10 +02:00
Alexander Grund
26d12650b6 Check return values of format functions 2022-05-27 11:50:40 +02:00
Artyom Beilis
6231333cc4 remove unused typedefs 2015-09-30 17:55:41 +03:00
Artyom Beilis
48ff4519b8 - Updates according to library requirements
- cleanup of inspect warnings
  - various requiremets like libraries.htm and maintainers.txt


[SVN r73786]
2011-08-15 19:04:34 +00:00
Artyom Beilis
4c30e01d23 First Version of Boost.Locale integrated into SVN trunk
[SVN r73017]
2011-07-12 13:57:36 +00:00