blob: 0125d419eaec24d556761c66c1c51d2ce8efe0fc [file] [log] [blame]
Howard Hinnant70505302010-06-17 00:34:59 +00001// -*- C++ -*-
Howard Hinnanteb9e9a32010-09-28 17:19:10 +00002//===----------------------------------------------------------------------===//
Howard Hinnant70505302010-06-17 00:34:59 +00003//
Chandler Carruth57b08b02019-01-19 10:56:40 +00004// 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 Hinnant70505302010-06-17 00:34:59 +00007//
8//===----------------------------------------------------------------------===//
Michal Gornyc32d47c2018-12-17 19:14:08 +00009//
10// NetBSD does not support LC_COLLATE at the moment
11// XFAIL: netbsd
Howard Hinnant70505302010-06-17 00:34:59 +000012
Dan Alberta85b27f2014-08-04 18:44:48 +000013// REQUIRES: locale.cs_CZ.ISO8859-2
14
Howard Hinnant70505302010-06-17 00:34:59 +000015// <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 Clowfd5ceb22016-04-26 16:24:44 +000024#include "test_macros.h"
Marshall Clow32227082013-01-05 03:21:01 +000025#include "test_iterators.h"
Ed Schoutenf4249902015-03-16 15:09:15 +000026#include "platform_support.h" // locale name macros
27
JF Bastien2df59c52019-02-04 20:31:13 +000028int main(int, char**)
Howard Hinnant70505302010-06-17 00:34:59 +000029{
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 Schoutenf4249902015-03-16 15:09:15 +000036 t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
Howard Hinnant70505302010-06-17 00:34:59 +000037 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 Schoutenf4249902015-03-16 15:09:15 +000045 t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
Howard Hinnant70505302010-06-17 00:34:59 +000046 assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
47 }
JF Bastien2df59c52019-02-04 20:31:13 +000048
49 return 0;
Howard Hinnant70505302010-06-17 00:34:59 +000050}