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 // <regex>
     12 
     13 // template <class charT> struct regex_traits;
     14 
     15 // template <class ForwardIterator>
     16 //   string_type
     17 //   transform_primary(ForwardIterator first, ForwardIterator last) const;
     18 
     19 #include <regex>
     20 #include <cassert>
     21 #include "test_iterators.h"
     22 
     23 int main()
     24 {
     25     {
     26         std::regex_traits<char> t;
     27         const char A[] = "A";
     28         const char Aacute[] = "\xC1";
     29         typedef forward_iterator<const char*> F;
     30         assert(t.transform_primary(F(A), F(A+1)) !=
     31                t.transform_primary(F(Aacute), F(Aacute+1)));
     32 /* Disable locale specific tests on Android because Android's NDK does not
     33  * support locales other than "C" and "POSIX".
     34  *
     35  * https://code.google.com/p/android/issues/detail?id=57313
     36  */
     37 #if !defined(__ANDROID__)
     38         t.imbue(std::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 #endif
     42     }
     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 /* Disable locale specific tests on Android because Android's NDK does not
     51  * support locales other than "C" and "POSIX".
     52  *
     53  * https://code.google.com/p/android/issues/detail?id=57313
     54  */
     55 #if !defined(__ANDROID__)
     56         t.imbue(std::locale("cs_CZ.ISO8859-2"));
     57         assert(t.transform_primary(F(A), F(A+1)) ==
     58                t.transform_primary(F(Aacute), F(Aacute+1)));
     59 #endif
     60     }
     61 }
     62