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
12 // XFAIL: LIBCXX-AIX-FIXME
13 // XFAIL: LIBCXX-FREEBSD-FIXME
14
15 // REQUIRES: locale.cs_CZ.ISO8859-2
16
17 // <regex>
18
19 // template <class charT> struct regex_traits;
20
21 // template <class ForwardIterator>
22 // string_type
23 // transform_primary(ForwardIterator first, ForwardIterator last) const;
24
25 #include <regex>
26 #include <cassert>
27
28 #include "test_macros.h"
29 #include "test_iterators.h"
30 #include "platform_support.h" // locale name macros
31
main(int,char **)32 int main(int, char**)
33 {
34 {
35 std::regex_traits<char> t;
36 const char A[] = "A";
37 const char Aacute[] = "\xC1";
38 typedef forward_iterator<const char*> F;
39 assert(t.transform_primary(F(A), F(A+1)) !=
40 t.transform_primary(F(Aacute), F(Aacute+1)));
41 t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
42 assert(t.transform_primary(F(A), F(A+1)) ==
43 t.transform_primary(F(Aacute), F(Aacute+1)));
44 }
45 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
46 {
47 std::regex_traits<wchar_t> t;
48 const wchar_t A[] = L"A";
49 const wchar_t Aacute[] = L"\xC1";
50 typedef forward_iterator<const wchar_t*> F;
51 assert(t.transform_primary(F(A), F(A+1)) !=
52 t.transform_primary(F(Aacute), F(Aacute+1)));
53 t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
54 assert(t.transform_primary(F(A), F(A+1)) ==
55 t.transform_primary(F(Aacute), F(Aacute+1)));
56 }
57 #endif
58
59 return 0;
60 }
61