1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <locale>
11 
12 // template <class charT> class ctype_byname;
13 
14 // charT toupper(charT) const;
15 
16 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
17 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
18 // XFAIL: linux
19 
20 #include <locale>
21 #include <cassert>
22 
23 #include "platform_support.h" // locale name macros
24 
main()25 int main()
26 {
27     {
28         std::locale l(LOCALE_en_US_UTF_8);
29         {
30             typedef std::ctype<char> F;
31             const F& f = std::use_facet<F>(l);
32 
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');
40             assert(f.toupper('\xFA') == '\xDA');
41         }
42     }
43     {
44         std::locale l("C");
45         {
46             typedef std::ctype<char> F;
47             const F& f = std::use_facet<F>(l);
48 
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     {
60         std::locale l(LOCALE_en_US_UTF_8);
61         {
62             typedef std::ctype<wchar_t> F;
63             const F& f = std::use_facet<F>(l);
64 
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);
80 
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 }
92