brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 80cd3f0 Raw
52 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// REQUIRES: locale.cs_CZ.ISO8859-213 14// <regex>15 16// template <class charT> struct regex_traits;17 18// template <class ForwardIterator>19//   string_type transform(ForwardIterator first, ForwardIterator last) const;20 21#include <regex>22#include <cassert>23#include "test_macros.h"24#include "test_iterators.h"25#include "platform_support.h" // locale name macros26 27int main(int, char**)28{29    {30        std::regex_traits<char> t;31        const char a[] = "a";32        const char B[] = "B";33        typedef forward_iterator<const char*> F;34        assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));35        t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));36        assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));37    }38#ifndef TEST_HAS_NO_WIDE_CHARACTERS39    {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#endif49 50  return 0;51}52