1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // REQUIRES: locale.en_US.UTF-8
14 // template <class charT> class ctype_byname;
16 // const charT* tolower(charT* low, const charT* high) const;
22 #include "platform_support.h" // locale name macros
29 typedef std::ctype_byname<char> F;
30 std::locale ll(l, new F(LOCALE_en_US_UTF_8));
31 const F& f = std::use_facet<F>(ll);
32 std::string in("c A\x07.a1");
34 assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
38 assert(in[3] == '\x07');
47 typedef std::ctype_byname<char> F;
48 std::locale ll(l, new F("C"));
49 const F& f = std::use_facet<F>(ll);
50 std::string in("\xDA A\x07.a1");
52 assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
53 assert(in[0] == '\xDA');
56 assert(in[3] == '\x07');
65 typedef std::ctype_byname<wchar_t> F;
66 std::locale ll(l, new F(LOCALE_en_US_UTF_8));
67 const F& f = std::use_facet<F>(ll);
68 std::wstring in(L"\xDA A\x07.a1");
70 assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
71 assert(in[0] == L'\xFA');
72 assert(in[1] == L' ');
73 assert(in[2] == L'a');
74 assert(in[3] == L'\x07');
75 assert(in[4] == L'.');
76 assert(in[5] == L'a');
77 assert(in[6] == L'1');
83 typedef std::ctype_byname<wchar_t> F;
84 std::locale ll(l, new F("C"));
85 const F& f = std::use_facet<F>(ll);
86 std::wstring in(L"\xDA A\x07.a1");
88 assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
89 assert(in[0] == L'\xDA');
90 assert(in[1] == L' ');
91 assert(in[2] == L'a');
92 assert(in[3] == L'\x07');
93 assert(in[4] == L'.');
94 assert(in[5] == L'a');
95 assert(in[6] == L'1');