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 
25 #include "platform_support.h" // locale name macros
26 
main()27 int main()
28 {
29     {
30         std::regex_traits<char> t;
31         const char A[] = "A";
32         const char Aacute[] = "\xC1";
33         typedef forward_iterator<const char*> F;
34         assert(t.transform_primary(F(A), F(A+1)) !=
35                t.transform_primary(F(Aacute), F(Aacute+1)));
36         t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
37         assert(t.transform_primary(F(A), F(A+1)) ==
38                t.transform_primary(F(Aacute), F(Aacute+1)));
39     }
40     {
41         std::regex_traits<wchar_t> t;
42         const wchar_t A[] = L"A";
43         const wchar_t Aacute[] = L"\xC1";
44         typedef forward_iterator<const wchar_t*> F;
45         assert(t.transform_primary(F(A), F(A+1)) !=
46                t.transform_primary(F(Aacute), F(Aacute+1)));
47         t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
48         assert(t.transform_primary(F(A), F(A+1)) ==
49                t.transform_primary(F(Aacute), F(Aacute+1)));
50     }
51 }
52