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 transform(ForwardIterator first, ForwardIterator last) const;
21 
22 #include <regex>
23 #include <cassert>
24 #include "test_macros.h"
25 #include "test_iterators.h"
26 #include "platform_support.h" // locale name macros
27 
main(int,char **)28 int main(int, char**)
29 {
30     {
31         std::regex_traits<char> t;
32         const char a[] = "a";
33         const char B[] = "B";
34         typedef forward_iterator<const char*> F;
35         assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
36         t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
37         assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
38     }
39 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
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         t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
47         assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
48     }
49 #endif
50 
51   return 0;
52 }
53