[SystemZ][z/OS][libcxx]: fix libcxx test cases failed on ebcdic mode on z/OS

This patch is to fix 2 libcxx test cases, test cases assumed 'a' > 'A' which is not case in z/OS platform on ebcdic mode, modified test cases to compare between upper letters or lower letters, or digits so ordering will be true for all platform.

Differential Revision: https://reviews.llvm.org/D104748
This commit is contained in:
Nancy Wang 2021-06-28 14:04:02 -04:00 committed by Muiez Ahmed
parent f85b9d6443
commit 4f5ebfdcd6
2 changed files with 21 additions and 11 deletions

View File

@ -19,18 +19,18 @@
int main(int, char**) int main(int, char**)
{ {
assert( std::char_traits<char>::lt('\0', 'A')); assert(std::char_traits<char>::lt('\0', 'A') == ('\0' < 'A'));
assert(!std::char_traits<char>::lt('A', '\0')); assert(std::char_traits<char>::lt('A', '\0') == ('A' < '\0'));
assert(!std::char_traits<char>::lt('a', 'a')); assert(std::char_traits<char>::lt('a', 'a') == ('a' < 'a'));
assert( std::char_traits<char>::lt('A', 'a')); assert(std::char_traits<char>::lt('A', 'a') == ('A' < 'a'));
assert(!std::char_traits<char>::lt('a', 'A')); assert(std::char_traits<char>::lt('a', 'A') == ('a' < 'A'));
assert( std::char_traits<char>::lt('a', 'z')); assert(std::char_traits<char>::lt('a', 'z') == ('a' < 'z'));
assert( std::char_traits<char>::lt('A', 'Z')); assert(std::char_traits<char>::lt('A', 'Z') == ('A' < 'Z'));
assert( std::char_traits<char>::lt(' ', 'A')); assert(std::char_traits<char>::lt(' ', 'A') == (' ' < 'A'));
assert( std::char_traits<char>::lt('A', '~')); assert(std::char_traits<char>::lt('A', '~') == ('A' < '~'));
return 0; return 0;
} }

View File

@ -19,8 +19,18 @@
int main(int, char**) int main(int, char**)
{ {
assert(!std::char_traits<wchar_t>::lt(L'a', L'a')); assert(std::char_traits<wchar_t>::lt(L'\0', L'A') == (L'\0' < L'A'));
assert( std::char_traits<wchar_t>::lt(L'A', L'a')); assert(std::char_traits<wchar_t>::lt(L'A', L'\0') == (L'A' < L'\0'));
assert(std::char_traits<wchar_t>::lt(L'a', L'a') == (L'a' < L'a'));
assert(std::char_traits<wchar_t>::lt(L'A', L'a') == (L'A' < L'a'));
assert(std::char_traits<wchar_t>::lt(L'a', L'A') == (L'a' < L'A'));
assert(std::char_traits<wchar_t>::lt(L'a', L'z') == (L'a' < L'z'));
assert(std::char_traits<wchar_t>::lt(L'A', L'Z') == (L'A' < L'Z'));
assert(std::char_traits<wchar_t>::lt(L' ', L'A') == (L' ' < L'A'));
assert(std::char_traits<wchar_t>::lt(L'A', L'~') == (L'A' < L'~'));
return 0; return 0;
} }