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 // REQUIRES: locale.cs_CZ.ISO8859-2
12 
13 // <regex>
14 
15 // template <class charT> struct regex_traits;
16 
17 // template <class ForwardIterator>
18 //   string_type
19 //   transform_primary(ForwardIterator first, ForwardIterator last) const;
20 
21 #include <regex>
22 #include <cassert>
23 #include "test_iterators.h"
24 
main()25 int main()
26 {
27     {
28         std::regex_traits<char> t;
29         const char A[] = "A";
30         const char Aacute[] = "\xC1";
31         typedef forward_iterator<const char*> F;
32         assert(t.transform_primary(F(A), F(A+1)) !=
33                t.transform_primary(F(Aacute), F(Aacute+1)));
34         t.imbue(std::locale("cs_CZ.ISO8859-2"));
35         assert(t.transform_primary(F(A), F(A+1)) ==
36                t.transform_primary(F(Aacute), F(Aacute+1)));
37     }
38     {
39         std::regex_traits<wchar_t> t;
40         const wchar_t A[] = L"A";
41         const wchar_t Aacute[] = L"\xC1";
42         typedef forward_iterator<const wchar_t*> F;
43         assert(t.transform_primary(F(A), F(A+1)) !=
44                t.transform_primary(F(Aacute), F(Aacute+1)));
45         t.imbue(std::locale("cs_CZ.ISO8859-2"));
46         assert(t.transform_primary(F(A), F(A+1)) ==
47                t.transform_primary(F(Aacute), F(Aacute+1)));
48     }
49 }
50