Home | History | Annotate | Download | only in re.traits
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <regex>
     11 
     12 // template <class charT> struct regex_traits;
     13 
     14 // template <class ForwardIterator>
     15 //   string_type
     16 //   lookup_collatename(ForwardIterator first, ForwardIterator last) const;
     17 
     18 #include <regex>
     19 #include <iterator>
     20 #include <cassert>
     21 #include "test_iterators.h"
     22 
     23 template <class char_type>
     24 void
     25 test(const char_type* A, const std::basic_string<char_type>& expected)
     26 {
     27     std::regex_traits<char_type> t;
     28     typedef forward_iterator<const char_type*> F;
     29     assert(t.lookup_collatename(F(A), F(A + t.length(A))) == expected);
     30 }
     31 
     32 int main()
     33 {
     34 #if !defined(__ANDROID__)
     35     std::locale::global(std::locale("cs_CZ.ISO8859-2"));
     36     test("ch", std::string("ch"));
     37 
     38     std::locale::global(std::locale("cs_CZ.ISO8859-2"));
     39     test(L"ch", std::wstring(L"ch"));
     40 #endif
     41 }
     42