Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <locale> |
| 11 | |
| 12 | // template <class charT> class ctype_byname; |
| 13 | |
| 14 | // charT toupper(charT) const; |
| 15 | |
Jonathan Roelofs | 3345961 | 2015-01-14 23:38:12 +0000 | [diff] [blame] | 16 | // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 |
| 17 | // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 |
Eric Fiselier | f523693 | 2014-08-21 02:03:01 +0000 | [diff] [blame] | 18 | // XFAIL: linux |
Howard Hinnant | dd854b2 | 2013-05-07 17:37:19 +0000 | [diff] [blame] | 19 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 20 | #include <locale> |
| 21 | #include <cassert> |
| 22 | |
Marshall Clow | 83e2c4d | 2013-01-05 03:21:01 +0000 | [diff] [blame] | 23 | #include "platform_support.h" // locale name macros |
Howard Hinnant | c0d0cba | 2011-10-03 15:23:59 +0000 | [diff] [blame] | 24 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 25 | int main() |
| 26 | { |
| 27 | { |
Howard Hinnant | c0d0cba | 2011-10-03 15:23:59 +0000 | [diff] [blame] | 28 | std::locale l(LOCALE_en_US_UTF_8); |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 29 | { |
| 30 | typedef std::ctype<char> F; |
| 31 | const F& f = std::use_facet<F>(l); |
Howard Hinnant | 22a74dc | 2010-08-22 00:39:25 +0000 | [diff] [blame] | 32 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 33 | assert(f.toupper(' ') == ' '); |
| 34 | assert(f.toupper('A') == 'A'); |
| 35 | assert(f.toupper('\x07') == '\x07'); |
| 36 | assert(f.toupper('.') == '.'); |
| 37 | assert(f.toupper('a') == 'A'); |
| 38 | assert(f.toupper('1') == '1'); |
| 39 | assert(f.toupper('\xDA') == '\xDA'); |
Joerg Sonnenberger | 63d8f7e | 2013-05-02 19:17:48 +0000 | [diff] [blame] | 40 | assert(f.toupper('\xFA') == '\xDA'); |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 41 | } |
| 42 | } |
| 43 | { |
| 44 | std::locale l("C"); |
| 45 | { |
| 46 | typedef std::ctype<char> F; |
| 47 | const F& f = std::use_facet<F>(l); |
Howard Hinnant | 22a74dc | 2010-08-22 00:39:25 +0000 | [diff] [blame] | 48 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 49 | assert(f.toupper(' ') == ' '); |
| 50 | assert(f.toupper('A') == 'A'); |
| 51 | assert(f.toupper('\x07') == '\x07'); |
| 52 | assert(f.toupper('.') == '.'); |
| 53 | assert(f.toupper('a') == 'A'); |
| 54 | assert(f.toupper('1') == '1'); |
| 55 | assert(f.toupper('\xDA') == '\xDA'); |
| 56 | assert(f.toupper('\xFA') == '\xFA'); |
| 57 | } |
| 58 | } |
| 59 | { |
Howard Hinnant | c0d0cba | 2011-10-03 15:23:59 +0000 | [diff] [blame] | 60 | std::locale l(LOCALE_en_US_UTF_8); |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 61 | { |
| 62 | typedef std::ctype<wchar_t> F; |
| 63 | const F& f = std::use_facet<F>(l); |
Howard Hinnant | 22a74dc | 2010-08-22 00:39:25 +0000 | [diff] [blame] | 64 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 65 | assert(f.toupper(L' ') == L' '); |
| 66 | assert(f.toupper(L'A') == L'A'); |
| 67 | assert(f.toupper(L'\x07') == L'\x07'); |
| 68 | assert(f.toupper(L'.') == L'.'); |
| 69 | assert(f.toupper(L'a') == L'A'); |
| 70 | assert(f.toupper(L'1') == L'1'); |
| 71 | assert(f.toupper(L'\xDA') == L'\xDA'); |
| 72 | assert(f.toupper(L'\xFA') == L'\xDA'); |
| 73 | } |
| 74 | } |
| 75 | { |
| 76 | std::locale l("C"); |
| 77 | { |
| 78 | typedef std::ctype<wchar_t> F; |
| 79 | const F& f = std::use_facet<F>(l); |
Howard Hinnant | 22a74dc | 2010-08-22 00:39:25 +0000 | [diff] [blame] | 80 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 81 | assert(f.toupper(L' ') == L' '); |
| 82 | assert(f.toupper(L'A') == L'A'); |
| 83 | assert(f.toupper(L'\x07') == L'\x07'); |
| 84 | assert(f.toupper(L'.') == L'.'); |
| 85 | assert(f.toupper(L'a') == L'A'); |
| 86 | assert(f.toupper(L'1') == L'1'); |
| 87 | assert(f.toupper(L'\xDA') == L'\xDA'); |
| 88 | assert(f.toupper(L'\xFA') == L'\xFA'); |
| 89 | } |
| 90 | } |
| 91 | } |