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 char* widen(const char* low, const char* high, charT* to) const;
18 // I doubt this test is portable
27 #include "platform_support.h" // locale name macros
32 std::locale l(LOCALE_en_US_UTF_8);
34 typedef std::ctype<wchar_t> F;
35 const F& f = std::use_facet<F>(l);
36 std::string in(" A\x07.a1\x85");
37 std::vector<wchar_t> v(in.size());
39 assert(f.widen(&in[0], in.data() + in.size(), v.data()) == in.data() + in.size());
42 assert(v[2] == L'\x07');
46 assert(v[6] == wchar_t(-1));
52 typedef std::ctype<wchar_t> F;
53 const F& f = std::use_facet<F>(l);
54 std::string in(" A\x07.a1\x85");
55 std::vector<wchar_t> v(in.size());
57 assert(f.widen(&in[0], in.data() + in.size(), v.data()) == in.data() + in.size());
60 assert(v[2] == L'\x07');
64 assert(v[6] == wchar_t(133));