]>
Commit | Line | Data |
---|---|---|
399eeef9 TS |
1 | // { dg-options "-std=gnu++11" } |
2 | ||
3 | // | |
4 | // 2013-08-01 Tim Shen <timshen91@gmail.com> | |
5 | // | |
aa118a03 | 6 | // Copyright (C) 2013-2014 Free Software Foundation, Inc. |
399eeef9 TS |
7 | // |
8 | // This file is part of the GNU ISO C++ Library. This library is free | |
9 | // software; you can redistribute it and/or modify it under the | |
10 | // terms of the GNU General Public License as published by the | |
11 | // Free Software Foundation; either version 3, or (at your option) | |
12 | // any later version. | |
13 | // | |
14 | // This library is distributed in the hope that it will be useful, | |
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | // GNU General Public License for more details. | |
18 | // | |
19 | // You should have received a copy of the GNU General Public License along | |
20 | // with this library; see the file COPYING3. If not see | |
21 | // <http://www.gnu.org/licenses/>. | |
22 | ||
23 | // 28.11.2 regex_match | |
24 | // Tests Extended bracket expression against a C-string. | |
25 | ||
26 | #include <regex> | |
27 | #include <testsuite_hooks.h> | |
6cb43087 TS |
28 | #include <testsuite_regex.h> |
29 | ||
30 | using namespace __gnu_test; | |
31 | using namespace std; | |
399eeef9 TS |
32 | |
33 | void | |
34 | test01() | |
35 | { | |
36 | bool test __attribute__((unused)) = true; | |
37 | ||
38 | { | |
39 | std::regex re("pre/[za-x]", std::regex::extended); | |
6cb43087 TS |
40 | VERIFY( regex_match_debug("pre/z", re) ); |
41 | VERIFY( regex_match_debug("pre/a", re) ); | |
42 | VERIFY( !regex_match_debug("pre/y", re) ); | |
399eeef9 TS |
43 | } |
44 | { | |
45 | std::regex re("pre/[[:uPPer:]]", std::regex::extended); | |
6cb43087 TS |
46 | VERIFY( regex_match_debug("pre/Z", re) ); |
47 | VERIFY( !regex_match_debug("pre/_", re) ); | |
48 | VERIFY( !regex_match_debug("pre/a", re) ); | |
49 | VERIFY( !regex_match_debug("pre/0", re) ); | |
399eeef9 TS |
50 | } |
51 | { | |
52 | std::regex re("pre/[[:lOWer:]]", std::regex::extended | std::regex::icase); | |
6cb43087 TS |
53 | VERIFY( regex_match_debug("pre/Z", re) ); |
54 | VERIFY( regex_match_debug("pre/a", re) ); | |
399eeef9 TS |
55 | } |
56 | { | |
57 | std::regex re("pre/[[:w:][.tilde.]]", std::regex::extended); | |
6cb43087 TS |
58 | VERIFY( regex_match_debug("pre/~", re) ); |
59 | VERIFY( regex_match_debug("pre/_", re) ); | |
60 | VERIFY( regex_match_debug("pre/a", re) ); | |
61 | VERIFY( regex_match_debug("pre/0", re) ); | |
399eeef9 | 62 | } |
756aa0c3 TS |
63 | { |
64 | std::regex re("pre/[[=a=]]", std::regex::extended); | |
6cb43087 TS |
65 | VERIFY( regex_match_debug("pre/a", re) ); |
66 | VERIFY( regex_match_debug("pre/A", re) ); | |
756aa0c3 | 67 | } |
399eeef9 TS |
68 | } |
69 | ||
70 | int | |
71 | main() | |
72 | { | |
73 | test01(); | |
74 | return 0; | |
75 | } |