15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
8c32d47c6SMichal Gorny //
9c32d47c6SMichal Gorny // NetBSD does not support LC_COLLATE at the moment
10c32d47c6SMichal Gorny // XFAIL: netbsd
11*bf4ddf18Szhijian // XFAIL: LIBCXX-AIX-FIXME
125a83710eSEric Fiselier 
135a83710eSEric Fiselier // REQUIRES: locale.cs_CZ.ISO8859-2
145a83710eSEric Fiselier 
155a83710eSEric Fiselier // <regex>
165a83710eSEric Fiselier 
175a83710eSEric Fiselier // template <class charT> struct regex_traits;
185a83710eSEric Fiselier 
195a83710eSEric Fiselier // template <class ForwardIterator>
205a83710eSEric Fiselier //   string_type
215a83710eSEric Fiselier //   transform_primary(ForwardIterator first, ForwardIterator last) const;
225a83710eSEric Fiselier 
235a83710eSEric Fiselier #include <regex>
245a83710eSEric Fiselier #include <cassert>
255a83710eSEric Fiselier 
26fd5ceb22SMarshall Clow #include "test_macros.h"
27fd5ceb22SMarshall Clow #include "test_iterators.h"
28f424990dSEd Schouten #include "platform_support.h" // locale name macros
29f424990dSEd Schouten 
main(int,char **)302df59c50SJF Bastien int main(int, char**)
315a83710eSEric Fiselier {
325a83710eSEric Fiselier     {
335a83710eSEric Fiselier         std::regex_traits<char> t;
345a83710eSEric Fiselier         const char A[] = "A";
355a83710eSEric Fiselier         const char Aacute[] = "\xC1";
365a83710eSEric Fiselier         typedef forward_iterator<const char*> F;
375a83710eSEric Fiselier         assert(t.transform_primary(F(A), F(A+1)) !=
385a83710eSEric Fiselier                t.transform_primary(F(Aacute), F(Aacute+1)));
39f424990dSEd Schouten         t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
405a83710eSEric Fiselier         assert(t.transform_primary(F(A), F(A+1)) ==
415a83710eSEric Fiselier                t.transform_primary(F(Aacute), F(Aacute+1)));
425a83710eSEric Fiselier     }
43f4c1258dSLouis Dionne #ifndef TEST_HAS_NO_WIDE_CHARACTERS
445a83710eSEric Fiselier     {
455a83710eSEric Fiselier         std::regex_traits<wchar_t> t;
465a83710eSEric Fiselier         const wchar_t A[] = L"A";
475a83710eSEric Fiselier         const wchar_t Aacute[] = L"\xC1";
485a83710eSEric Fiselier         typedef forward_iterator<const wchar_t*> F;
495a83710eSEric Fiselier         assert(t.transform_primary(F(A), F(A+1)) !=
505a83710eSEric Fiselier                t.transform_primary(F(Aacute), F(Aacute+1)));
51f424990dSEd Schouten         t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
525a83710eSEric Fiselier         assert(t.transform_primary(F(A), F(A+1)) ==
535a83710eSEric Fiselier                t.transform_primary(F(Aacute), F(Aacute+1)));
545a83710eSEric Fiselier     }
55f4c1258dSLouis Dionne #endif
562df59c50SJF Bastien 
572df59c50SJF Bastien   return 0;
585a83710eSEric Fiselier }
59