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 // <regex>
12 
13 // template <class charT> struct regex_traits;
14 
15 // template <class ForwardIterator>
16 //   string_type transform(ForwardIterator first, ForwardIterator last) const;
17 
18 #include <regex>
19 #include <cassert>
20 #include "test_iterators.h"
21 
main()22 int main()
23 {
24     {
25         std::regex_traits<char> t;
26         const char a[] = "a";
27         const char B[] = "B";
28         typedef forward_iterator<const char*> F;
29         assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
30 /* Disable locale specific tests on Android because Android's NDK does not
31  * support locales other than "C" and "POSIX".
32  *
33  * https://code.google.com/p/android/issues/detail?id=57313
34  */
35 #if !defined(__ANDROID__)
36         t.imbue(std::locale("cs_CZ.ISO8859-2"));
37         assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
38 #endif
39     }
40     {
41         std::regex_traits<wchar_t> t;
42         const wchar_t a[] = L"a";
43         const wchar_t B[] = L"B";
44         typedef forward_iterator<const wchar_t*> F;
45         assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
46 /* Disable locale specific tests on Android because Android's NDK does not
47  * support locales other than "C" and "POSIX".
48  *
49  * https://code.google.com/p/android/issues/detail?id=57313
50  */
51 #if !defined(__ANDROID__)
52         t.imbue(std::locale("cs_CZ.ISO8859-2"));
53         assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
54 #endif
55     }
56 }
57