xref: /llvm-project/libcxx/test/std/re/re.traits/translate.pass.cpp (revision f4c1258d5633fcf06385ff3fd1f4bf57ab971964)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <regex>
10 
11 // template <class charT> struct regex_traits;
12 
13 // charT translate(charT c) const;
14 
15 #include <regex>
16 #include <cassert>
17 #include "test_macros.h"
18 
main(int,char **)19 int main(int, char**)
20 {
21     {
22         std::regex_traits<char> t;
23         assert(t.translate('a') == 'a');
24         assert(t.translate('B') == 'B');
25         assert(t.translate('c') == 'c');
26     }
27 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
28     {
29         std::regex_traits<wchar_t> t;
30         assert(t.translate(L'a') == L'a');
31         assert(t.translate(L'B') == L'B');
32         assert(t.translate(L'c') == L'c');
33     }
34 #endif
35 
36   return 0;
37 }
38