2 //===----------------------------------------------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
12 // template <class charT> struct regex_traits;
14 // charT translate_nocase(charT c) const;
16 // REQUIRES: locale.en_US.UTF-8
21 #include "test_macros.h"
22 #include "platform_support.h"
27 std::regex_traits
<char> t
;
28 assert(t
.translate_nocase(' ') == ' ');
29 assert(t
.translate_nocase('A') == 'a');
30 assert(t
.translate_nocase('\x07') == '\x07');
31 assert(t
.translate_nocase('.') == '.');
32 assert(t
.translate_nocase('a') == 'a');
33 assert(t
.translate_nocase('1') == '1');
34 assert(t
.translate_nocase('\xDA') == '\xDA');
35 assert(t
.translate_nocase('\xFA') == '\xFA');
36 t
.imbue(std::locale(LOCALE_en_US_UTF_8
));
37 assert(t
.translate_nocase(' ') == ' ');
38 assert(t
.translate_nocase('A') == 'a');
39 assert(t
.translate_nocase('\x07') == '\x07');
40 assert(t
.translate_nocase('.') == '.');
41 assert(t
.translate_nocase('a') == 'a');
42 assert(t
.translate_nocase('1') == '1');
45 std::regex_traits
<wchar_t> t
;
46 assert(t
.translate_nocase(L
' ') == L
' ');
47 assert(t
.translate_nocase(L
'A') == L
'a');
48 assert(t
.translate_nocase(L
'\x07') == L
'\x07');
49 assert(t
.translate_nocase(L
'.') == L
'.');
50 assert(t
.translate_nocase(L
'a') == L
'a');
51 assert(t
.translate_nocase(L
'1') == L
'1');
52 assert(t
.translate_nocase(L
'\xDA') == L
'\xDA');
53 assert(t
.translate_nocase(L
'\xFA') == L
'\xFA');
54 t
.imbue(std::locale(LOCALE_en_US_UTF_8
));
55 assert(t
.translate_nocase(L
' ') == L
' ');
56 assert(t
.translate_nocase(L
'A') == L
'a');
57 assert(t
.translate_nocase(L
'\x07') == L
'\x07');
58 assert(t
.translate_nocase(L
'.') == L
'.');
59 assert(t
.translate_nocase(L
'a') == L
'a');
60 assert(t
.translate_nocase(L
'1') == L
'1');
61 assert(t
.translate_nocase(L
'\xDA') == L
'\xFA');
62 assert(t
.translate_nocase(L
'\xFA') == L
'\xFA');