| 1 | // { dg-do run { target c++11 } } |
| 2 | // { dg-timeout-factor 3 } |
| 3 | |
| 4 | // |
| 5 | // Copyright (C) 2014-2025 Free Software Foundation, Inc. |
| 6 | // |
| 7 | // This file is part of the GNU ISO C++ Library. This library is free |
| 8 | // software; you can redistribute it and/or modify it under the |
| 9 | // terms of the GNU General Public License as published by the |
| 10 | // Free Software Foundation; either version 3, or (at your option) |
| 11 | // any later version. |
| 12 | // |
| 13 | // This library is distributed in the hope that it will be useful, |
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | // GNU General Public License for more details. |
| 17 | // |
| 18 | // You should have received a copy of the GNU General Public License along |
| 19 | // with this library; see the file COPYING3. If not see |
| 20 | // <http://www.gnu.org/licenses/>. |
| 21 | |
| 22 | #include <regex> |
| 23 | #include <testsuite_hooks.h> |
| 24 | #include <testsuite_regex.h> |
| 25 | |
| 26 | using namespace __gnu_test; |
| 27 | using namespace std; |
| 28 | |
| 29 | // libstdc++/63199 |
| 30 | void |
| 31 | test01() |
| 32 | { |
| 33 | std::setlocale(LC_ALL, ""); |
| 34 | |
| 35 | std::wstring current_token(L"II."); |
| 36 | |
| 37 | std::vector<std::wregex> regex_vector; |
| 38 | |
| 39 | for (int i = 0; i < 4; ++i) |
| 40 | { |
| 41 | std::regex_constants::syntax_option_type flag; |
| 42 | flag = std::regex_constants::ECMAScript | std::regex_constants::icase; |
| 43 | |
| 44 | std::wregex reg; |
| 45 | reg.imbue(std::locale("")); |
| 46 | reg.assign(L"^(M*(?:CM|DC{1,3}|D|CD|C{1,3}){0,1}(?:XC|LX{1,3}|L|XL|X{1,3}){0,1}(?:IX|VI{0,3}|IV|I{1,3}){0,1}\\.)$", flag); |
| 47 | |
| 48 | regex_vector.emplace_back(reg); |
| 49 | } |
| 50 | |
| 51 | for (auto cit = regex_vector.cbegin(); cit != regex_vector.cend(); ++cit) |
| 52 | { |
| 53 | std::wstring::const_iterator it1 = current_token.begin(); |
| 54 | std::wstring::const_iterator it2 = current_token.end(); |
| 55 | std::wsmatch current_token_match; |
| 56 | |
| 57 | regex_match_debug(it1, it2, current_token_match, *cit); |
| 58 | VERIFY(current_token_match[0] == current_token); |
| 59 | VERIFY(current_token_match[1] == current_token); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | int |
| 64 | main() |
| 65 | { |
| 66 | test01(); |
| 67 | return 0; |
| 68 | } |