1 // -*- C++ -*- 2 //===----------------------------------------------------------------------===// 3 // 4 // The LLVM Compiler Infrastructure 5 // 6 // This file is dual licensed under the MIT and the University of Illinois Open 7 // Source Licenses. See LICENSE.TXT for details. 8 // 9 //===----------------------------------------------------------------------===// 10 11 // <regex> 12 13 // template <class charT> struct regex_traits; 14 15 // charT translate_nocase(charT c) const; 16 17 // REQUIRES: locale.en_US.UTF-8 18 19 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 20 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 21 22 // TODO: investigation needed 23 // XFAIL: linux-gnu 24 25 #include <regex> 26 #include <cassert> 27 28 #include "platform_support.h" 29 main()30int main() 31 { 32 { 33 std::regex_traits<char> t; 34 assert(t.translate_nocase(' ') == ' '); 35 assert(t.translate_nocase('A') == 'a'); 36 assert(t.translate_nocase('\x07') == '\x07'); 37 assert(t.translate_nocase('.') == '.'); 38 assert(t.translate_nocase('a') == 'a'); 39 assert(t.translate_nocase('1') == '1'); 40 assert(t.translate_nocase('\xDA') == '\xDA'); 41 assert(t.translate_nocase('\xFA') == '\xFA'); 42 t.imbue(std::locale(LOCALE_en_US_UTF_8)); 43 assert(t.translate_nocase(' ') == ' '); 44 assert(t.translate_nocase('A') == 'a'); 45 assert(t.translate_nocase('\x07') == '\x07'); 46 assert(t.translate_nocase('.') == '.'); 47 assert(t.translate_nocase('a') == 'a'); 48 assert(t.translate_nocase('1') == '1'); 49 assert(t.translate_nocase('\xDA') == '\xFA'); 50 assert(t.translate_nocase('\xFA') == '\xFA'); 51 } 52 { 53 std::regex_traits<wchar_t> t; 54 assert(t.translate_nocase(L' ') == L' '); 55 assert(t.translate_nocase(L'A') == L'a'); 56 assert(t.translate_nocase(L'\x07') == L'\x07'); 57 assert(t.translate_nocase(L'.') == L'.'); 58 assert(t.translate_nocase(L'a') == L'a'); 59 assert(t.translate_nocase(L'1') == L'1'); 60 assert(t.translate_nocase(L'\xDA') == L'\xDA'); 61 assert(t.translate_nocase(L'\xFA') == L'\xFA'); 62 t.imbue(std::locale(LOCALE_en_US_UTF_8)); 63 assert(t.translate_nocase(L' ') == L' '); 64 assert(t.translate_nocase(L'A') == L'a'); 65 assert(t.translate_nocase(L'\x07') == L'\x07'); 66 assert(t.translate_nocase(L'.') == L'.'); 67 assert(t.translate_nocase(L'a') == L'a'); 68 assert(t.translate_nocase(L'1') == L'1'); 69 assert(t.translate_nocase(L'\xDA') == L'\xFA'); 70 assert(t.translate_nocase(L'\xFA') == L'\xFA'); 71 } 72 } 73