Skip to content

Commit

Permalink
[libcxx] [test] Fix the get/put long_double_ru_RU tests on Apple plat…
Browse files Browse the repository at this point in the history
…forms

This fixes issue #45084 (https://llvm.org/PR45739).

Remove unnecessary trailing spaces after the "RUB" international
currency symbol (and after the plain number in some parts of the
put_long_double test).

Both of these test files are
`XFAIL: netbsd || linux || LIBCXX-WINDOWS-FIXME`, and then have some of
their test cases commented out when `__APPLE__`. This patch comments-in
those test cases and adjusts them all to work on Apple, while leaving the
test `XFAIL`ed on NetBSD, Linux, and Windows.

Differential Revision: https://reviews.llvm.org/D120316
  • Loading branch information
mstorsjo committed Feb 24, 2022
1 parent 7fd60ee commit 5333732
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 100 deletions.
Expand Up @@ -35,19 +35,6 @@

#include "platform_support.h" // locale name macros

// TODO:
// Some of the assertions in this test are failing on Apple platforms.
// Until we figure out the problem and fix it, disable these tests on
// Apple platforms. Note that we're not using XFAIL or UNSUPPORTED markup
// here, because this test would otherwise be disabled on all platforms
// we test. To avoid this test becoming entirely stale, we just disable
// the parts that fail.
//
// See https://llvm.org/PR45739 for the bug tracking this.
#if defined(__APPLE__)
# define APPLE_FIXME
#endif

typedef std::money_get<char, cpp17_input_iterator<const char*> > Fn;

class my_facet
Expand Down Expand Up @@ -228,7 +215,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
std::string v = "-1 234 567,89 RUB ";
std::string v = "-1 234 567,89 RUB";
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
long double ex;
Expand All @@ -240,7 +227,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
std::string v = "-1 234 567,89 RUB ";
std::string v = "-1 234 567,89 RUB";
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
Expand Down Expand Up @@ -310,7 +297,7 @@ int main(int, char**)
assert(ex == -123456789);
}
{ // zero, showbase
std::string v = "0,00 RUB ";
std::string v = "0,00 RUB";
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
Expand All @@ -320,9 +307,8 @@ int main(int, char**)
assert(err == std::ios_base::goodbit);
assert(ex == 0);
}
#if !defined(APPLE_FIXME)
{ // zero, showbase
std::string v = "0,00 RUB ";
std::string v = "0,00 RUB";
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
long double ex;
Expand All @@ -334,9 +320,8 @@ int main(int, char**)
assert(ex == 0);
std::noshowbase(ios);
}
#endif
{ // negative one, showbase
std::string v = "-0,01 RUB ";
std::string v = "-0,01 RUB";
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
Expand All @@ -346,9 +331,8 @@ int main(int, char**)
assert(err == std::ios_base::goodbit);
assert(ex == -1);
}
#if !defined(APPLE_FIXME)
{ // negative one, showbase
std::string v = "-0,01 RUB ";
std::string v = "-0,01 RUB";
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
long double ex;
Expand All @@ -360,9 +344,8 @@ int main(int, char**)
assert(ex == -1);
std::noshowbase(ios);
}
#endif
{ // positive, showbase
std::string v = "1 234 567,89 RUB ";
std::string v = "1 234 567,89 RUB";
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
Expand All @@ -372,9 +355,8 @@ int main(int, char**)
assert(err == std::ios_base::goodbit);
assert(ex == 123456789);
}
#if !defined(APPLE_FIXME)
{ // positive, showbase
std::string v = "1 234 567,89 RUB ";
std::string v = "1 234 567,89 RUB";
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
long double ex;
Expand All @@ -386,10 +368,8 @@ int main(int, char**)
assert(ex == 123456789);
std::noshowbase(ios);
}
#endif
#if !defined(APPLE_FIXME)
{ // negative, showbase
std::string v = "-1 234 567,89 RUB ";
std::string v = "-1 234 567,89 RUB";
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
long double ex;
Expand All @@ -401,7 +381,6 @@ int main(int, char**)
assert(ex == -123456789);
std::noshowbase(ios);
}
#endif
{ // negative, showbase
std::string v = "-1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".";
std::showbase(ios);
Expand Down Expand Up @@ -571,7 +550,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
std::wstring v = L"-1 234 567,89 RUB ";
std::wstring v = L"-1 234 567,89 RUB";
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
Expand All @@ -583,7 +562,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
std::wstring v = L"-1 234 567,89 RUB ";
std::wstring v = L"-1 234 567,89 RUB";
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
Expand Down Expand Up @@ -653,7 +632,7 @@ int main(int, char**)
assert(ex == -123456789);
}
{ // zero, showbase
std::wstring v = L"0,00 RUB ";
std::wstring v = L"0,00 RUB";
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
Expand All @@ -663,9 +642,8 @@ int main(int, char**)
assert(err == std::ios_base::goodbit);
assert(ex == 0);
}
#if !defined(APPLE_FIXME)
{ // zero, showbase
std::wstring v = L"0,00 RUB ";
std::wstring v = L"0,00 RUB";
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
Expand All @@ -677,9 +655,8 @@ int main(int, char**)
assert(ex == 0);
std::noshowbase(ios);
}
#endif
{ // negative one, showbase
std::wstring v = L"-0,01 RUB ";
std::wstring v = L"-0,01 RUB";
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
Expand All @@ -689,9 +666,8 @@ int main(int, char**)
assert(err == std::ios_base::goodbit);
assert(ex == -1);
}
#if !defined(APPLE_FIXME)
{ // negative one, showbase
std::wstring v = L"-0,01 RUB ";
std::wstring v = L"-0,01 RUB";
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
Expand All @@ -703,9 +679,8 @@ int main(int, char**)
assert(ex == -1);
std::noshowbase(ios);
}
#endif
{ // positive, showbase
std::wstring v = L"1 234 567,89 RUB ";
std::wstring v = L"1 234 567,89 RUB";
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
Expand All @@ -715,9 +690,8 @@ int main(int, char**)
assert(err == std::ios_base::goodbit);
assert(ex == 123456789);
}
#if !defined(APPLE_FIXME)
{ // positive, showbase
std::wstring v = L"1 234 567,89 RUB ";
std::wstring v = L"1 234 567,89 RUB";
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
Expand All @@ -729,10 +703,8 @@ int main(int, char**)
assert(ex == 123456789);
std::noshowbase(ios);
}
#endif
#if !defined(APPLE_FIXME)
{ // negative, showbase
std::wstring v = L"-1 234 567,89 RUB ";
std::wstring v = L"-1 234 567,89 RUB";
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
Expand All @@ -744,7 +716,6 @@ int main(int, char**)
assert(ex == -123456789);
std::noshowbase(ios);
}
#endif
{ // negative, showbase
std::wstring v = L"-1 234 567,89 \x440\x443\x431"".";
std::showbase(ios);
Expand Down

0 comments on commit 5333732

Please sign in to comment.