]>
Commit | Line | Data |
---|---|---|
974afa58 | 1 | // { dg-do run { target c++11 } } |
b6a8e347 | 2 | // { dg-timeout-factor 2 } |
974afa58 TS |
3 | |
4 | // | |
99dee823 | 5 | // Copyright (C) 2016-2021 Free Software Foundation, Inc. |
974afa58 TS |
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 | // 28.7 Class template regex_traits [re.traits] | |
23 | ||
24 | #include <regex> | |
25 | #include <testsuite_hooks.h> | |
26 | ||
27 | using namespace std; | |
28 | ||
29 | void | |
30 | test01() | |
31 | { | |
32 | { | |
33 | regex re("[T-f]", regex::icase); | |
34 | ||
35 | VERIFY(regex_match("A", re)); | |
36 | VERIFY(regex_match("F", re)); | |
37 | VERIFY(regex_match("a", re)); | |
38 | VERIFY(regex_match("f", re)); | |
39 | ||
40 | VERIFY(!regex_match("G", re)); | |
41 | VERIFY(!regex_match("S", re)); | |
42 | VERIFY(!regex_match("g", re)); | |
43 | VERIFY(!regex_match("s", re)); | |
44 | ||
45 | VERIFY(regex_match("T", re)); | |
46 | VERIFY(regex_match("Z", re)); | |
47 | VERIFY(regex_match("t", re)); | |
48 | VERIFY(regex_match("z", re)); | |
49 | } | |
50 | // icase works with std::regex_traits<>, because we know how it's implemented. | |
51 | { | |
52 | regex re("[T-f]", regex::icase | regex::collate); | |
53 | ||
54 | VERIFY(regex_match("A", re)); | |
55 | VERIFY(regex_match("F", re)); | |
56 | VERIFY(regex_match("a", re)); | |
57 | VERIFY(regex_match("f", re)); | |
58 | ||
59 | VERIFY(!regex_match("G", re)); | |
60 | VERIFY(!regex_match("S", re)); | |
61 | VERIFY(!regex_match("g", re)); | |
62 | VERIFY(!regex_match("s", re)); | |
63 | ||
64 | VERIFY(regex_match("T", re)); | |
65 | VERIFY(regex_match("Z", re)); | |
66 | VERIFY(regex_match("t", re)); | |
67 | VERIFY(regex_match("z", re)); | |
68 | } | |
69 | } | |
70 | ||
71 | int main() | |
72 | { | |
73 | test01(); | |
74 | return 0; | |
75 | } |