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