Debian Codegraph @

libcxx/test/std/re/re.traits/transform.pass.cpp

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