Howard Hinnant | 7050530 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
Howard Hinnant | eb9e9a3 | 2010-09-28 17:19:10 +0000 | [diff] [blame] | 2 | //===----------------------------------------------------------------------===// |
Howard Hinnant | 7050530 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 3 | // |
Chandler Carruth | 57b08b0 | 2019-01-19 10:56:40 +0000 | [diff] [blame] | 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Howard Hinnant | 7050530 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
Michal Gorny | c32d47c | 2018-12-17 19:14:08 +0000 | [diff] [blame] | 9 | // |
| 10 | // NetBSD does not support LC_COLLATE at the moment |
| 11 | // XFAIL: netbsd |
Howard Hinnant | 7050530 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 12 | |
Dan Albert | a85b27f | 2014-08-04 18:44:48 +0000 | [diff] [blame] | 13 | // REQUIRES: locale.cs_CZ.ISO8859-2 |
| 14 | |
Howard Hinnant | 7050530 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 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> |
Marshall Clow | fd5ceb2 | 2016-04-26 16:24:44 +0000 | [diff] [blame] | 24 | #include "test_macros.h" |
Marshall Clow | 3222708 | 2013-01-05 03:21:01 +0000 | [diff] [blame] | 25 | #include "test_iterators.h" |
Ed Schouten | f424990 | 2015-03-16 15:09:15 +0000 | [diff] [blame] | 26 | #include "platform_support.h" // locale name macros |
| 27 | |
JF Bastien | 2df59c5 | 2019-02-04 20:31:13 +0000 | [diff] [blame] | 28 | int main(int, char**) |
Howard Hinnant | 7050530 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 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))); |
Ed Schouten | f424990 | 2015-03-16 15:09:15 +0000 | [diff] [blame] | 36 | t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2)); |
Howard Hinnant | 7050530 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 37 | assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1))); |
| 38 | } |
| 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))); |
Ed Schouten | f424990 | 2015-03-16 15:09:15 +0000 | [diff] [blame] | 45 | t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2)); |
Howard Hinnant | 7050530 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 46 | assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1))); |
| 47 | } |
JF Bastien | 2df59c5 | 2019-02-04 20:31:13 +0000 | [diff] [blame] | 48 | |
| 49 | return 0; |
Howard Hinnant | 7050530 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 50 | } |