[libcxx-commits] [PATCH] D120317: [libcxx] [test] Fix get/put long_double_ru_RU on Glibc, FreeBSD and Windows
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 23 09:44:21 PST 2022
mstorsjo added inline comments.
================
Comment at: libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp:53
+// FreeBSD and Windows use U+00A0 NO-BREAK SPACE.
+static std::wstring convert_thousands_sep(std::wstring const& in) {
+#if defined(TEST_HAS_GLIBC) || defined(__FreeBSD__) || defined(_WIN32)
----------------
Mordante wrote:
> Would it make sense to move this function to a helper header and share the code between the two tests?
I guess that could be done - we have the same in the get/put long_double fr_FR tests too (but with slightly different constellation of separators across systems). Do you have a suggestion on where to place it?
================
Comment at: libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp:56
+ std::wstring out;
+ unsigned I = 0;
+ bool seen_num_start = false;
----------------
Mordante wrote:
> Please reduce the scope to the loop.
> Please use a lower case `i`.
Ok, can do. This is based on copypaste from the existing fr_FR tests though. But if we move the helper out somewhere, we could do the same cleanup at the same time.
================
Comment at: libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp:61
+ seen_decimal |= in[I] == L',';
+ seen_num_start |= in[I] == L'-' || std::iswdigit(in[I]);
+ if (seen_decimal || !seen_num_start || in[I] != L' ') {
----------------
Mordante wrote:
> `std::iswdigit` requires `<cwctype>`.
Thanks, good catch!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120317/new/
https://reviews.llvm.org/D120317
More information about the libcxx-commits
mailing list