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