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 // NetBSD does not support LC_COLLATE at the moment
10 // XFAIL: netbsd
11 // XFAIL: LIBCXX-AIX-FIXME
12 
13 // REQUIRES: locale.cs_CZ.ISO8859-2
14 
15 // <regex>
16 
17 // template <class charT> struct regex_traits;
18 
19 // template <class ForwardIterator>
20 //   string_type
21 //   transform_primary(ForwardIterator first, ForwardIterator last) const;
22 
23 #include <regex>
24 #include <cassert>
25 
26 #include "test_macros.h"
27 #include "test_iterators.h"
28 #include "platform_support.h" // locale name macros
29 
main(int,char **)30 int main(int, char**)
31 {
32     {
33         std::regex_traits<char> t;
34         const char A[] = "A";
35         const char Aacute[] = "\xC1";
36         typedef forward_iterator<const char*> F;
37         assert(t.transform_primary(F(A), F(A+1)) !=
38                t.transform_primary(F(Aacute), F(Aacute+1)));
39         t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
40         assert(t.transform_primary(F(A), F(A+1)) ==
41                t.transform_primary(F(Aacute), F(Aacute+1)));
42     }
43 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
44     {
45         std::regex_traits<wchar_t> t;
46         const wchar_t A[] = L"A";
47         const wchar_t Aacute[] = L"\xC1";
48         typedef forward_iterator<const wchar_t*> F;
49         assert(t.transform_primary(F(A), F(A+1)) !=
50                t.transform_primary(F(Aacute), F(Aacute+1)));
51         t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
52         assert(t.transform_primary(F(A), F(A+1)) ==
53                t.transform_primary(F(Aacute), F(Aacute+1)));
54     }
55 #endif
56 
57   return 0;
58 }
59