[libc++] Update locale grouping tests (#119463)

Fixes #119047
This commit is contained in:
Vitaly Buka 2024-12-16 09:50:59 -08:00 committed by GitHub
parent 1dac0cd41f
commit 31272e4f83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 28 deletions

View File

@ -89,27 +89,22 @@ int main(int, char**)
}
#endif
#if defined( _WIN32) || defined(_AIX)
std::string us_grouping = "\3";
#else
std::string us_grouping = "\3\3";
#endif
{
Fnf f(LOCALE_en_US_UTF_8, 1);
assert(f.grouping() == us_grouping);
assert(f.grouping() == "\3" || f.grouping() == "\3\3");
}
{
Fnt f(LOCALE_en_US_UTF_8, 1);
assert(f.grouping() == us_grouping);
assert(f.grouping() == "\3" || f.grouping() == "\3\3");
}
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
Fwf f(LOCALE_en_US_UTF_8, 1);
assert(f.grouping() == us_grouping);
assert(f.grouping() == "\3" || f.grouping() == "\3\3");
}
{
Fwt f(LOCALE_en_US_UTF_8, 1);
assert(f.grouping() == us_grouping);
assert(f.grouping() == "\3" || f.grouping() == "\3\3");
}
#endif
@ -132,27 +127,22 @@ int main(int, char**)
}
#endif
#if defined( _WIN32) || defined(_AIX)
std::string ru_grouping = "\3";
#else
std::string ru_grouping = "\3\3";
#endif
{
Fnf f(LOCALE_ru_RU_UTF_8, 1);
assert(f.grouping() == ru_grouping);
assert(f.grouping() == "\3" || f.grouping() == "\3\3");
}
{
Fnt f(LOCALE_ru_RU_UTF_8, 1);
assert(f.grouping() == ru_grouping);
assert(f.grouping() == "\3" || f.grouping() == "\3\3");
}
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
Fwf f(LOCALE_ru_RU_UTF_8, 1);
assert(f.grouping() == ru_grouping);
assert(f.grouping() == "\3" || f.grouping() == "\3\3");
}
{
Fwt f(LOCALE_ru_RU_UTF_8, 1);
assert(f.grouping() == ru_grouping);
assert(f.grouping() == "\3" || f.grouping() == "\3\3");
}
#endif

View File

@ -48,21 +48,13 @@ int main(int, char**)
{
typedef char C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
#if defined(_WIN32) || defined(_AIX)
assert(np.grouping() == "\3");
#else
assert(np.grouping() == "\3\3");
#endif
assert(np.grouping() == "\3" || np.grouping() == "\3\3");
}
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
{
typedef wchar_t C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
# if defined(_WIN32) || defined(_AIX)
assert(np.grouping() == "\3");
# else
assert(np.grouping() == "\3\3");
# endif
assert(np.grouping() == "\3" || np.grouping() == "\3\3");
}
#endif
}