1 // -*- C++ -*- 2 //===----------------------------------------------------------------------===// 3 // 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 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // NetBSD does not support LC_COLLATE at the moment 11 // XFAIL: netbsd 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 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 { 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 49 return 0; 50 } 51