1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
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
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // NetBSD does not support LC_COLLATE at the moment
11 // XFAIL: netbsd
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     {
44         std::regex_traits<wchar_t> t;
45         const wchar_t A[] = L"A";
46         const wchar_t Aacute[] = L"\xC1";
47         typedef forward_iterator<const wchar_t*> F;
48         assert(t.transform_primary(F(A), F(A+1)) !=
49                t.transform_primary(F(Aacute), F(Aacute+1)));
50         t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
51         assert(t.transform_primary(F(A), F(A+1)) ==
52                t.transform_primary(F(Aacute), F(Aacute+1)));
53     }
54 
55   return 0;
56 }
57