diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-12-30 09:28:58 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-12-30 09:28:58 +0000 |
commit | abf424334df700f84899c65658e5388c5e79c136 (patch) | |
tree | 05faa569a2a7b6283b3af50f174ffcd86ac55122 /libcxx/test/std/localization | |
parent | 6f896a9866bd2b8965721836271eb6461e537a07 (diff) | |
download | bcm5719-llvm-abf424334df700f84899c65658e5388c5e79c136.tar.gz bcm5719-llvm-abf424334df700f84899c65658e5388c5e79c136.zip |
Get ctype_byname tests passing on Linux.
llvm-svn: 290746
Diffstat (limited to 'libcxx/test/std/localization')
6 files changed, 96 insertions, 75 deletions
diff --git a/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp b/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp index 741f47f4380..4488e9c3f73 100644 --- a/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp @@ -17,7 +17,6 @@ // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 -// XFAIL: linux #include <locale> #include <cassert> @@ -27,10 +26,11 @@ int main() { { - std::locale l(LOCALE_en_US_UTF_8); + std::locale l; { - typedef std::ctype<char> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<char> F; + std::locale ll(l, new F(LOCALE_en_US_UTF_8)); + const F& f = std::use_facet<F>(ll); assert(f.tolower(' ') == ' '); assert(f.tolower('A') == 'a'); @@ -38,15 +38,15 @@ int main() assert(f.tolower('.') == '.'); assert(f.tolower('a') == 'a'); assert(f.tolower('1') == '1'); - assert(f.tolower('\xDA') == '\xFA'); assert(f.tolower('\xFA') == '\xFA'); } } { - std::locale l("C"); + std::locale l; { - typedef std::ctype<char> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<char> F; + std::locale ll(l, new F("C")); + const F& f = std::use_facet<F>(ll); assert(f.tolower(' ') == ' '); assert(f.tolower('A') == 'a'); @@ -59,10 +59,11 @@ int main() } } { - std::locale l(LOCALE_en_US_UTF_8); + std::locale l; { - typedef std::ctype<wchar_t> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<wchar_t> F; + std::locale ll(l, new F(LOCALE_en_US_UTF_8)); + const F& f = std::use_facet<F>(ll); assert(f.tolower(L' ') == L' '); assert(f.tolower(L'A') == L'a'); @@ -75,10 +76,11 @@ int main() } } { - std::locale l("C"); + std::locale l; { - typedef std::ctype<wchar_t> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<wchar_t> F; + std::locale ll(l, new F("C")); + const F& f = std::use_facet<F>(ll); assert(f.tolower(L' ') == L' '); assert(f.tolower(L'A') == L'a'); diff --git a/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp b/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp index bf1cb64b22c..0c224e342fa 100644 --- a/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp @@ -17,7 +17,6 @@ // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 -// XFAIL: linux #include <locale> #include <string> @@ -28,14 +27,15 @@ int main() { { - std::locale l(LOCALE_en_US_UTF_8); + std::locale l; { - typedef std::ctype<char> F; - const F& f = std::use_facet<F>(l); - std::string in("\xDA A\x07.a1"); + typedef std::ctype_byname<char> F; + std::locale ll(l, new F(LOCALE_en_US_UTF_8)); + const F& f = std::use_facet<F>(ll); + std::string in("c A\x07.a1"); assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size()); - assert(in[0] == '\xFA'); + assert(in[0] == 'c'); assert(in[1] == ' '); assert(in[2] == 'a'); assert(in[3] == '\x07'); @@ -45,10 +45,11 @@ int main() } } { - std::locale l("C"); + std::locale l; { - typedef std::ctype<char> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<char> F; + std::locale ll(l, new F("C")); + const F& f = std::use_facet<F>(ll); std::string in("\xDA A\x07.a1"); assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size()); @@ -62,10 +63,11 @@ int main() } } { - std::locale l(LOCALE_en_US_UTF_8); + std::locale l; { - typedef std::ctype<wchar_t> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<wchar_t> F; + std::locale ll(l, new F(LOCALE_en_US_UTF_8)); + const F& f = std::use_facet<F>(ll); std::wstring in(L"\xDA A\x07.a1"); assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size()); @@ -79,10 +81,11 @@ int main() } } { - std::locale l("C"); + std::locale l; { - typedef std::ctype<wchar_t> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<wchar_t> F; + std::locale ll(l, new F("C")); + const F& f = std::use_facet<F>(ll); std::wstring in(L"\xDA A\x07.a1"); assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size()); diff --git a/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp b/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp index 3044ba1897f..0985de5007d 100644 --- a/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp @@ -17,7 +17,7 @@ // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 -// XFAIL: linux + #include <locale> #include <cassert> @@ -27,10 +27,11 @@ int main() { { - std::locale l(LOCALE_en_US_UTF_8); + std::locale l; { - typedef std::ctype<char> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<char> F; + std::locale ll(l, new F(LOCALE_en_US_UTF_8)); + const F& f = std::use_facet<F>(ll); assert(f.toupper(' ') == ' '); assert(f.toupper('A') == 'A'); @@ -39,14 +40,15 @@ int main() assert(f.toupper('a') == 'A'); assert(f.toupper('1') == '1'); assert(f.toupper('\xDA') == '\xDA'); - assert(f.toupper('\xFA') == '\xDA'); + assert(f.toupper('c') == 'C'); } } { - std::locale l("C"); + std::locale l; { - typedef std::ctype<char> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<char> F; + std::locale ll(l, new F("C")); + const F& f = std::use_facet<F>(ll); assert(f.toupper(' ') == ' '); assert(f.toupper('A') == 'A'); @@ -59,10 +61,11 @@ int main() } } { - std::locale l(LOCALE_en_US_UTF_8); + std::locale l; { - typedef std::ctype<wchar_t> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<wchar_t> F; + std::locale ll(l, new F(LOCALE_en_US_UTF_8)); + const F& f = std::use_facet<F>(ll); assert(f.toupper(L' ') == L' '); assert(f.toupper(L'A') == L'A'); @@ -75,10 +78,11 @@ int main() } } { - std::locale l("C"); + std::locale l; { - typedef std::ctype<wchar_t> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<wchar_t> F; + std::locale ll(l, new F("C")); + const F& f = std::use_facet<F>(ll); assert(f.toupper(L' ') == L' '); assert(f.toupper(L'A') == L'A'); diff --git a/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp b/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp index be6ba4c3e90..ba047754916 100644 --- a/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp @@ -17,7 +17,6 @@ // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 -// XFAIL: linux #include <locale> #include <string> @@ -28,14 +27,15 @@ int main() { { - std::locale l(LOCALE_en_US_UTF_8); + std::locale l; { - typedef std::ctype<char> F; - const F& f = std::use_facet<F>(l); - std::string in("\xFA A\x07.a1"); + typedef std::ctype_byname<char> F; + std::locale ll(l, new F(LOCALE_en_US_UTF_8)); + const F& f = std::use_facet<F>(ll); + std::string in("c A\x07.a1"); assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size()); - assert(in[0] == '\xDA'); + assert(in[0] == 'C'); assert(in[1] == ' '); assert(in[2] == 'A'); assert(in[3] == '\x07'); @@ -45,10 +45,11 @@ int main() } } { - std::locale l("C"); + std::locale l; { - typedef std::ctype<char> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<char> F; + std::locale ll(l, new F("C")); + const F& f = std::use_facet<F>(ll); std::string in("\xFA A\x07.a1"); assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size()); @@ -62,10 +63,11 @@ int main() } } { - std::locale l(LOCALE_en_US_UTF_8); + std::locale l; { - typedef std::ctype<wchar_t> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<wchar_t> F; + std::locale ll(l, new F(LOCALE_en_US_UTF_8)); + const F& f = std::use_facet<F>(ll); std::wstring in(L"\xFA A\x07.a1"); assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size()); @@ -79,14 +81,15 @@ int main() } } { - std::locale l("C"); + std::locale l; { - typedef std::ctype<wchar_t> F; - const F& f = std::use_facet<F>(l); - std::wstring in(L"\xFA A\x07.a1"); + typedef std::ctype_byname<wchar_t> F; + std::locale ll(l, new F("C")); + const F& f = std::use_facet<F>(ll); + std::wstring in(L"\u00FA A\x07.a1"); assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size()); - assert(in[0] == L'\xFA'); + assert(in[0] == L'\u00FA'); assert(in[1] == L' '); assert(in[2] == L'A'); assert(in[3] == L'\x07'); diff --git a/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp b/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp index e5c49defa11..8f51d12d7c7 100644 --- a/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp @@ -17,7 +17,6 @@ // I doubt this test is portable -// XFAIL: linux #include <locale> #include <cassert> @@ -28,10 +27,11 @@ int main() { { - std::locale l(LOCALE_en_US_UTF_8); + std::locale l; { - typedef std::ctype<wchar_t> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<wchar_t> F; + std::locale ll(l, new F(LOCALE_en_US_UTF_8)); + const F& f = std::use_facet<F>(ll); assert(f.widen(' ') == L' '); assert(f.widen('A') == L'A'); @@ -43,10 +43,11 @@ int main() } } { - std::locale l("C"); + std::locale l; { - typedef std::ctype<wchar_t> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<wchar_t> F; + std::locale ll(l, new F("C")); + const F& f = std::use_facet<F>(ll); assert(f.widen(' ') == L' '); assert(f.widen('A') == L'A'); @@ -54,7 +55,11 @@ int main() assert(f.widen('.') == L'.'); assert(f.widen('a') == L'a'); assert(f.widen('1') == L'1'); - assert(f.widen(char(-5)) == wchar_t(251)); +#ifdef __APPLE__ + assert(f.widen(char(-5)) == L'\u00fb'); +#else + assert(f.widen(char(-5)) == wchar_t(-1)); +#endif } } } diff --git a/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp b/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp index c16974a2414..7a382c4dfa2 100644 --- a/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp @@ -17,8 +17,6 @@ // I doubt this test is portable -// XFAIL: linux - #include <locale> #include <string> #include <vector> @@ -31,8 +29,9 @@ int main() { std::locale l(LOCALE_en_US_UTF_8); { - typedef std::ctype<wchar_t> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<wchar_t> F; + std::locale ll(l, new F(LOCALE_en_US_UTF_8)); + F const& f = std::use_facet<F>(ll); std::string in(" A\x07.a1\x85"); std::vector<wchar_t> v(in.size()); @@ -49,8 +48,9 @@ int main() { std::locale l("C"); { - typedef std::ctype<wchar_t> F; - const F& f = std::use_facet<F>(l); + typedef std::ctype_byname<wchar_t> F; + std::locale ll(l, new F("C")); + const F& f = std::use_facet<F>(ll); std::string in(" A\x07.a1\x85"); std::vector<wchar_t> v(in.size()); @@ -61,7 +61,11 @@ int main() assert(v[3] == L'.'); assert(v[4] == L'a'); assert(v[5] == L'1'); - assert(v[6] == wchar_t(133)); +#ifdef __APPLE__ + assert(v[6] == L'\x85'); +#else + assert(v[6] == wchar_t(-1)); +#endif } } } |