blob: 3d6c405964b2f65327f13960bbdbe138b1367c9d [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00007//
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
19int 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 Hinnant22a74dc2010-08-22 00:39:25 +000026
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000027 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 Hinnant22a74dc2010-08-22 00:39:25 +000042
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000043 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 Hinnant22a74dc2010-08-22 00:39:25 +000058
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000059 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 Hinnant22a74dc2010-08-22 00:39:25 +000074
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000075 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}