Home | History | Annotate | Download | only in re.traits
      1 // -*- C++ -*-
      2 //===----------------------------------------------------------------------===//
      3 //
      4 //                     The LLVM Compiler Infrastructure
      5 //
      6 // This file is dual licensed under the MIT and the University of Illinois Open
      7 // Source Licenses. See LICENSE.TXT for details.
      8 //
      9 //===----------------------------------------------------------------------===//
     10 //
     11 // NetBSD does not support LC_COLLATE at the moment
     12 // XFAIL: netbsd
     13 
     14 // REQUIRES: locale.cs_CZ.ISO8859-2
     15 
     16 // <regex>
     17 
     18 // template <class charT> struct regex_traits;
     19 
     20 // template <class ForwardIterator>
     21 //   string_type transform(ForwardIterator first, ForwardIterator last) const;
     22 
     23 #include <regex>
     24 #include <cassert>
     25 #include "test_macros.h"
     26 #include "test_iterators.h"
     27 #include "platform_support.h" // locale name macros
     28 
     29 int main()
     30 {
     31     {
     32         std::regex_traits<char> t;
     33         const char a[] = "a";
     34         const char B[] = "B";
     35         typedef forward_iterator<const char*> F;
     36         assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
     37         t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
     38         assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
     39     }
     40     {
     41         std::regex_traits<wchar_t> t;
     42         const wchar_t a[] = L"a";
     43         const wchar_t B[] = L"B";
     44         typedef forward_iterator<const wchar_t*> F;
     45         assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
     46         t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
     47         assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
     48     }
     49 }
     50