Skip to content

Commit

Permalink
[libc++] Update locale grouping tests (#119463)
Browse files Browse the repository at this point in the history
Fixes #119047

(cherry picked from commit 31272e4f83f24fee1bf37ebc8ea7dd4d082edea8)
  • Loading branch information
vitalybuka authored and arichardson committed Jan 15, 2025
1 parent e89fe6d commit e67ed96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit e67ed96

Please sign in to comment.