brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 422e3a5 Raw
61 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8//9// NetBSD does not support LC_COLLATE at the moment10// XFAIL: netbsd11 12// XFAIL: LIBCXX-AIX-FIXME13// XFAIL: LIBCXX-FREEBSD-FIXME14 15// REQUIRES: locale.cs_CZ.ISO8859-216 17// <regex>18 19// template <class charT> struct regex_traits;20 21// template <class ForwardIterator>22//   string_type23//   transform_primary(ForwardIterator first, ForwardIterator last) const;24 25#include <regex>26#include <cassert>27 28#include "test_macros.h"29#include "test_iterators.h"30#include "platform_support.h" // locale name macros31 32int main(int, char**)33{34    {35        std::regex_traits<char> t;36        const char A[] = "A";37        const char Aacute[] = "\xC1";38        typedef forward_iterator<const char*> F;39        assert(t.transform_primary(F(A), F(A+1)) !=40               t.transform_primary(F(Aacute), F(Aacute+1)));41        t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));42        assert(t.transform_primary(F(A), F(A+1)) ==43               t.transform_primary(F(Aacute), F(Aacute+1)));44    }45#ifndef TEST_HAS_NO_WIDE_CHARACTERS46    {47        std::regex_traits<wchar_t> t;48        const wchar_t A[] = L"A";49        const wchar_t Aacute[] = L"\xC1";50        typedef forward_iterator<const wchar_t*> F;51        assert(t.transform_primary(F(A), F(A+1)) !=52               t.transform_primary(F(Aacute), F(Aacute+1)));53        t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));54        assert(t.transform_primary(F(A), F(A+1)) ==55               t.transform_primary(F(Aacute), F(Aacute+1)));56    }57#endif58 59  return 0;60}61