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 widen(char c) const; 15 16// I doubt this test is portable 17 18#include <locale> 19#include <cassert> 20#include <limits.h> 21 22#include "platform_support.h" // locale name macros 23 24int main() 25{ 26 { 27 std::locale l(LOCALE_en_US_UTF_8); 28 { 29 typedef std::ctype<wchar_t> F; 30 const F& f = std::use_facet<F>(l); 31 32 assert(f.widen(' ') == L' '); 33 assert(f.widen('A') == L'A'); 34 assert(f.widen('\x07') == L'\x07'); 35 assert(f.widen('.') == L'.'); 36 assert(f.widen('a') == L'a'); 37 assert(f.widen('1') == L'1'); 38 assert(f.widen(char(-5)) == wchar_t(-1)); 39 } 40 } 41 { 42 std::locale l("C"); 43 { 44 typedef std::ctype<wchar_t> F; 45 const F& f = std::use_facet<F>(l); 46 47 assert(f.widen(' ') == L' '); 48 assert(f.widen('A') == L'A'); 49 assert(f.widen('\x07') == L'\x07'); 50 assert(f.widen('.') == L'.'); 51 assert(f.widen('a') == L'a'); 52 assert(f.widen('1') == L'1'); 53 assert(f.widen(char(-5)) == wchar_t(251)); 54 } 55 } 56} 57