]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/28_regex/constants/syntax_option_type.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 28_regex / constants / syntax_option_type.cc
1 // { dg-do run { target c++11 } }
2 // { dg-timeout-factor 2 }
3 //
4 // 2009-06-17 Stephen M. Webb <stephen.webb@xandros.com>
5 //
6 // Copyright (C) 2009-2021 Free Software Foundation, Inc.
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.5.1
24
25 #include <regex>
26 #include <testsuite_hooks.h>
27
28 void
29 test01()
30 {
31 std::regex_constants::syntax_option_type option { };
32 option = option | std::regex_constants::icase;
33 option = option | std::regex_constants::nosubs;
34 option = option | std::regex_constants::optimize;
35 option = option | std::regex_constants::collate;
36 option = option | std::regex_constants::ECMAScript;
37 option = option | std::regex_constants::basic;
38 option = option | std::regex_constants::extended;
39 option = option | std::regex_constants::awk;
40 option = option | std::regex_constants::grep;
41 option = option | std::regex_constants::egrep;
42 }
43
44 void
45 test02()
46 {
47 std::regex_constants::syntax_option_type option { };
48 option = option & std::regex_constants::icase;
49 option = option & std::regex_constants::nosubs;
50 option = option & std::regex_constants::optimize;
51 option = option & std::regex_constants::collate;
52 option = option & std::regex_constants::ECMAScript;
53 option = option & std::regex_constants::basic;
54 option = option & std::regex_constants::extended;
55 option = option & std::regex_constants::awk;
56 option = option & std::regex_constants::grep;
57 option = option & std::regex_constants::egrep;
58 }
59
60 void
61 test03()
62 {
63 std::regex_constants::syntax_option_type option { };
64 option = ~std::regex_constants::icase;
65 option = ~std::regex_constants::nosubs;
66 option = ~std::regex_constants::optimize;
67 option = ~std::regex_constants::collate;
68 option = ~std::regex_constants::ECMAScript;
69 option = ~std::regex_constants::basic;
70 option = ~std::regex_constants::extended;
71 option = ~std::regex_constants::awk;
72 option = ~std::regex_constants::grep;
73 option = ~std::regex_constants::egrep;
74 option = option;
75 }
76
77 void
78 test04_constexpr()
79 {
80 using namespace std::regex_constants;
81 constexpr auto a1 __attribute__((unused)) = icase | awk;
82 constexpr auto a2 __attribute__((unused)) = icase & awk;
83 constexpr auto a3 __attribute__((unused)) = ~grep;
84 }
85
86 void
87 test05()
88 {
89 using namespace std;
90 using namespace regex_constants;
91 regex re("((a)(s))", nosubs | ECMAScript);
92 VERIFY(re.mark_count() == 0);
93 }
94
95 int main()
96 {
97 test01();
98 test02();
99 test03();
100 test04_constexpr();
101 test05();
102 return 0;
103 }