Howard Hinnant | 3257c98 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
Howard Hinnant | 0ce0224 | 2010-09-28 17:19:10 +0000 | [diff] [blame] | 2 | //===----------------------------------------------------------------------===// |
Howard Hinnant | 3257c98 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 3 | // |
| 4 | // The LLVM Compiler Infrastructure |
| 5 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 6 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 7 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | 3257c98 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
Dan Albert | b4ed5ca | 2014-08-04 18:44:48 +0000 | [diff] [blame] | 11 | // REQUIRES: locale.cs_CZ.ISO8859-2 |
| 12 | |
Howard Hinnant | 3257c98 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 13 | // <regex> |
| 14 | |
| 15 | // template <class charT> struct regex_traits; |
| 16 | |
| 17 | // template <class ForwardIterator> |
| 18 | // string_type |
| 19 | // transform_primary(ForwardIterator first, ForwardIterator last) const; |
| 20 | |
Howard Hinnant | 3257c98 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 21 | #include <regex> |
| 22 | #include <cassert> |
Marshall Clow | 83e2c4d | 2013-01-05 03:21:01 +0000 | [diff] [blame] | 23 | #include "test_iterators.h" |
Howard Hinnant | 3257c98 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 24 | |
Ed Schouten | eda3fca | 2015-03-16 15:09:15 +0000 | [diff] [blame^] | 25 | #include "platform_support.h" // locale name macros |
| 26 | |
Howard Hinnant | 3257c98 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 27 | int main() |
| 28 | { |
| 29 | { |
| 30 | std::regex_traits<char> t; |
| 31 | const char A[] = "A"; |
| 32 | const char Aacute[] = "\xC1"; |
| 33 | typedef forward_iterator<const char*> F; |
Howard Hinnant | bbd8086 | 2010-08-22 00:45:01 +0000 | [diff] [blame] | 34 | assert(t.transform_primary(F(A), F(A+1)) != |
Howard Hinnant | 3257c98 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 35 | t.transform_primary(F(Aacute), F(Aacute+1))); |
Ed Schouten | eda3fca | 2015-03-16 15:09:15 +0000 | [diff] [blame^] | 36 | t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2)); |
Howard Hinnant | 3257c98 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 37 | assert(t.transform_primary(F(A), F(A+1)) == |
| 38 | t.transform_primary(F(Aacute), F(Aacute+1))); |
| 39 | } |
| 40 | { |
| 41 | std::regex_traits<wchar_t> t; |
| 42 | const wchar_t A[] = L"A"; |
| 43 | const wchar_t Aacute[] = L"\xC1"; |
| 44 | typedef forward_iterator<const wchar_t*> F; |
| 45 | assert(t.transform_primary(F(A), F(A+1)) != |
| 46 | t.transform_primary(F(Aacute), F(Aacute+1))); |
Ed Schouten | eda3fca | 2015-03-16 15:09:15 +0000 | [diff] [blame^] | 47 | t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2)); |
Howard Hinnant | 3257c98 | 2010-06-17 00:34:59 +0000 | [diff] [blame] | 48 | assert(t.transform_primary(F(A), F(A+1)) == |
| 49 | t.transform_primary(F(Aacute), F(Aacute+1))); |
| 50 | } |
| 51 | } |