Skip to content

[libcxx][test][AIX] address more platform differences in locale tests #94826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// NetBSD does not support LC_MONETARY at the moment
// XFAIL: netbsd

// XFAIL: LIBCXX-AIX-FIXME

// REQUIRES: locale.fr_FR.UTF-8

// <locale>
Expand All @@ -32,6 +30,13 @@
#include "platform_support.h" // locale name macros
#include "test_macros.h"

#ifdef _AIX
// the AIX libc expects U202F as LC_MONETARY thousands_sep
# define THOUSANDS_SEP L"\u202F"
#else
# define THOUSANDS_SEP L" "
#endif

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

class my_facet
Expand Down Expand Up @@ -432,26 +437,24 @@ int main(int, char**)
assert(ex == -1);
}
{ // positive
std::wstring v = convert_thousands_sep(L"1 234 567,89 ");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == 123456789);
std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 ");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == 123456789);
}
{ // negative
std::wstring v = convert_thousands_sep(L"-1 234 567,89");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == -123456789);
std::wstring v = convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == -123456789);
}
{ // negative
std::wstring v = L"-1234567,89";
Expand Down Expand Up @@ -512,64 +515,59 @@ int main(int, char**)
assert(ex == -1);
}
{ // positive, showbase
std::wstring v = convert_thousands_sep(L"1 234 567,89 \u20ac"); // EURO SIGN
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == 123456789);
std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 \u20ac"); // EURO SIGN
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == 123456789);
}
{ // positive, showbase
std::wstring v = convert_thousands_sep(L"1 234 567,89 \u20ac"); // EURO SIGN
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == 123456789);
std::noshowbase(ios);
std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 \u20ac"); // EURO SIGN
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == 123456789);
std::noshowbase(ios);
}
{ // negative, showbase
std::wstring v = convert_thousands_sep(L"-1 234 567,89 \u20ac"); // EURO SIGN
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == -123456789);
std::noshowbase(ios);
std::wstring v = convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 \u20ac"); // EURO SIGN
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == -123456789);
std::noshowbase(ios);
}
{ // negative, showbase
std::wstring v = convert_thousands_sep(L"1 234 567,89 EUR -");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
assert(base(iter) == v.data() + 13);
assert(err == std::ios_base::failbit);
std::noshowbase(ios);
std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR -");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
assert(base(iter) == v.data() + 13);
assert(err == std::ios_base::failbit);
std::noshowbase(ios);
}
{ // negative, showbase
std::wstring v = convert_thousands_sep(L"1 234 567,89 EUR -");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
assert(base(iter) == v.data() + 13);
assert(err == std::ios_base::goodbit);
assert(ex == 123456789);
std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR -");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
assert(base(iter) == v.data() + 13);
assert(err == std::ios_base::goodbit);
assert(ex == 123456789);
}
}
{
Expand Down Expand Up @@ -598,26 +596,24 @@ int main(int, char**)
assert(ex == -1);
}
{ // positive
std::wstring v = convert_thousands_sep(L"1 234 567,89 ");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == 123456789);
std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 ");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == 123456789);
}
{ // negative
std::wstring v = convert_thousands_sep(L"-1 234 567,89");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == -123456789);
std::wstring v = convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == -123456789);
}
{ // negative
std::wstring v = L"-1234567,89";
Expand Down Expand Up @@ -678,64 +674,59 @@ int main(int, char**)
assert(ex == -1);
}
{ // positive, showbase
std::wstring v = convert_thousands_sep(L"1 234 567,89 EUR");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == 123456789);
std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == 123456789);
}
{ // positive, showbase
std::wstring v = convert_thousands_sep(L"1 234 567,89 EUR");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == 123456789);
std::noshowbase(ios);
std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == 123456789);
std::noshowbase(ios);
}
{ // negative, showbase
std::wstring v = convert_thousands_sep(L"-1 234 567,89 EUR");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == -123456789);
std::noshowbase(ios);
std::wstring v = convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
assert(base(iter) == v.data() + v.size());
assert(err == std::ios_base::eofbit);
assert(ex == -123456789);
std::noshowbase(ios);
}
{ // negative, showbase
std::wstring v = convert_thousands_sep(L"1 234 567,89 Eu-");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
assert(base(iter) == v.data() + 14);
assert(err == std::ios_base::failbit);
std::noshowbase(ios);
std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 Eu-");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
assert(base(iter) == v.data() + 14);
assert(err == std::ios_base::failbit);
std::noshowbase(ios);
}
{ // negative, showbase
std::wstring v = convert_thousands_sep(L"1 234 567,89 Eu-");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
assert(base(iter) == v.data() + 13);
assert(err == std::ios_base::goodbit);
assert(ex == 123456789);
std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 Eu-");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
assert(base(iter) == v.data() + 13);
assert(err == std::ios_base::goodbit);
assert(ex == 123456789);
}
}
#endif // TEST_HAS_NO_WIDE_CHARACTERS
Expand Down
Loading
Loading