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 | |
| 16 | #include <locale> |
| 17 | #include <cassert> |
| 18 | |
| 19 | int main() |
| 20 | { |
| 21 | { |
| 22 | std::locale l("en_US"); |
| 23 | { |
| 24 | typedef std::ctype<char> F; |
| 25 | const F& f = std::use_facet<F>(l); |
Howard Hinnant | 22a74dc | 2010-08-22 00:39:25 +0000 | [diff] [blame] | 26 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 27 | assert(f.toupper(' ') == ' '); |
| 28 | assert(f.toupper('A') == 'A'); |
| 29 | assert(f.toupper('\x07') == '\x07'); |
| 30 | assert(f.toupper('.') == '.'); |
| 31 | assert(f.toupper('a') == 'A'); |
| 32 | assert(f.toupper('1') == '1'); |
| 33 | assert(f.toupper('\xDA') == '\xDA'); |
| 34 | assert(f.toupper('\xFA') == '\xFA'); |
| 35 | } |
| 36 | } |
| 37 | { |
| 38 | std::locale l("C"); |
| 39 | { |
| 40 | typedef std::ctype<char> F; |
| 41 | const F& f = std::use_facet<F>(l); |
Howard Hinnant | 22a74dc | 2010-08-22 00:39:25 +0000 | [diff] [blame] | 42 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 43 | assert(f.toupper(' ') == ' '); |
| 44 | assert(f.toupper('A') == 'A'); |
| 45 | assert(f.toupper('\x07') == '\x07'); |
| 46 | assert(f.toupper('.') == '.'); |
| 47 | assert(f.toupper('a') == 'A'); |
| 48 | assert(f.toupper('1') == '1'); |
| 49 | assert(f.toupper('\xDA') == '\xDA'); |
| 50 | assert(f.toupper('\xFA') == '\xFA'); |
| 51 | } |
| 52 | } |
| 53 | { |
| 54 | std::locale l("en_US"); |
| 55 | { |
| 56 | typedef std::ctype<wchar_t> F; |
| 57 | const F& f = std::use_facet<F>(l); |
Howard Hinnant | 22a74dc | 2010-08-22 00:39:25 +0000 | [diff] [blame] | 58 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 59 | assert(f.toupper(L' ') == L' '); |
| 60 | assert(f.toupper(L'A') == L'A'); |
| 61 | assert(f.toupper(L'\x07') == L'\x07'); |
| 62 | assert(f.toupper(L'.') == L'.'); |
| 63 | assert(f.toupper(L'a') == L'A'); |
| 64 | assert(f.toupper(L'1') == L'1'); |
| 65 | assert(f.toupper(L'\xDA') == L'\xDA'); |
| 66 | assert(f.toupper(L'\xFA') == L'\xDA'); |
| 67 | } |
| 68 | } |
| 69 | { |
| 70 | std::locale l("C"); |
| 71 | { |
| 72 | typedef std::ctype<wchar_t> F; |
| 73 | const F& f = std::use_facet<F>(l); |
Howard Hinnant | 22a74dc | 2010-08-22 00:39:25 +0000 | [diff] [blame] | 74 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 75 | assert(f.toupper(L' ') == L' '); |
| 76 | assert(f.toupper(L'A') == L'A'); |
| 77 | assert(f.toupper(L'\x07') == L'\x07'); |
| 78 | assert(f.toupper(L'.') == L'.'); |
| 79 | assert(f.toupper(L'a') == L'A'); |
| 80 | assert(f.toupper(L'1') == L'1'); |
| 81 | assert(f.toupper(L'\xDA') == L'\xDA'); |
| 82 | assert(f.toupper(L'\xFA') == L'\xFA'); |
| 83 | } |
| 84 | } |
| 85 | } |