1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 
11 // <regex>
12 
13 // namespace regex_constants
14 // {
15 //
16 // emum syntax_option_type  // bitmask type
17 // {
18 //     icase      = unspecified,
19 //     nosubs     = unspecified,
20 //     optimize   = unspecified,
21 //     collate    = unspecified,
22 //     ECMAScript = unspecified,
23 //     basic      = unspecified,
24 //     extended   = unspecified,
25 //     awk        = unspecified,
26 //     grep       = unspecified,
27 //     egrep      = unspecified
28 // };
29 //
30 // }
31 
32 #include <regex>
33 #include <cassert>
34 #include "test_macros.h"
35 
main()36 int main()
37 {
38     assert(std::regex_constants::icase != 0);
39     assert(std::regex_constants::nosubs != 0);
40     assert(std::regex_constants::optimize != 0);
41     assert(std::regex_constants::collate != 0);
42     assert(std::regex_constants::ECMAScript == 0);
43     assert(std::regex_constants::basic != 0);
44     assert(std::regex_constants::extended != 0);
45     assert(std::regex_constants::awk != 0);
46     assert(std::regex_constants::grep != 0);
47     assert(std::regex_constants::egrep != 0);
48 
49     assert((std::regex_constants::icase & std::regex_constants::nosubs) == 0);
50     assert((std::regex_constants::icase & std::regex_constants::optimize) == 0);
51     assert((std::regex_constants::icase & std::regex_constants::collate) == 0);
52     assert((std::regex_constants::icase & std::regex_constants::ECMAScript) == 0);
53     assert((std::regex_constants::icase & std::regex_constants::basic) == 0);
54     assert((std::regex_constants::icase & std::regex_constants::extended) == 0);
55     assert((std::regex_constants::icase & std::regex_constants::awk) == 0);
56     assert((std::regex_constants::icase & std::regex_constants::grep) == 0);
57     assert((std::regex_constants::icase & std::regex_constants::egrep) == 0);
58 
59     assert((std::regex_constants::nosubs & std::regex_constants::optimize) == 0);
60     assert((std::regex_constants::nosubs & std::regex_constants::collate) == 0);
61     assert((std::regex_constants::nosubs & std::regex_constants::ECMAScript) == 0);
62     assert((std::regex_constants::nosubs & std::regex_constants::basic) == 0);
63     assert((std::regex_constants::nosubs & std::regex_constants::extended) == 0);
64     assert((std::regex_constants::nosubs & std::regex_constants::awk) == 0);
65     assert((std::regex_constants::nosubs & std::regex_constants::grep) == 0);
66     assert((std::regex_constants::nosubs & std::regex_constants::egrep) == 0);
67 
68     assert((std::regex_constants::optimize & std::regex_constants::collate) == 0);
69     assert((std::regex_constants::optimize & std::regex_constants::ECMAScript) == 0);
70     assert((std::regex_constants::optimize & std::regex_constants::basic) == 0);
71     assert((std::regex_constants::optimize & std::regex_constants::extended) == 0);
72     assert((std::regex_constants::optimize & std::regex_constants::awk) == 0);
73     assert((std::regex_constants::optimize & std::regex_constants::grep) == 0);
74     assert((std::regex_constants::optimize & std::regex_constants::egrep) == 0);
75 
76     assert((std::regex_constants::collate & std::regex_constants::ECMAScript) == 0);
77     assert((std::regex_constants::collate & std::regex_constants::basic) == 0);
78     assert((std::regex_constants::collate & std::regex_constants::extended) == 0);
79     assert((std::regex_constants::collate & std::regex_constants::awk) == 0);
80     assert((std::regex_constants::collate & std::regex_constants::grep) == 0);
81     assert((std::regex_constants::collate & std::regex_constants::egrep) == 0);
82 
83     assert((std::regex_constants::ECMAScript & std::regex_constants::basic) == 0);
84     assert((std::regex_constants::ECMAScript & std::regex_constants::extended) == 0);
85     assert((std::regex_constants::ECMAScript & std::regex_constants::awk) == 0);
86     assert((std::regex_constants::ECMAScript & std::regex_constants::grep) == 0);
87     assert((std::regex_constants::ECMAScript & std::regex_constants::egrep) == 0);
88 
89     assert((std::regex_constants::basic & std::regex_constants::extended) == 0);
90     assert((std::regex_constants::basic & std::regex_constants::awk) == 0);
91     assert((std::regex_constants::basic & std::regex_constants::grep) == 0);
92     assert((std::regex_constants::basic & std::regex_constants::egrep) == 0);
93 
94     assert((std::regex_constants::extended & std::regex_constants::awk) == 0);
95     assert((std::regex_constants::extended & std::regex_constants::grep) == 0);
96     assert((std::regex_constants::extended & std::regex_constants::egrep) == 0);
97 
98     assert((std::regex_constants::awk & std::regex_constants::grep) == 0);
99     assert((std::regex_constants::awk & std::regex_constants::egrep) == 0);
100 
101     assert((std::regex_constants::grep & std::regex_constants::egrep) == 0);
102 
103     assert((std::regex_constants::icase | std::regex_constants::nosubs) != 0);
104     assert((std::regex_constants::icase ^ std::regex_constants::nosubs) != 0);
105 
106     std::regex_constants::syntax_option_type e1 = std::regex_constants::icase;
107     std::regex_constants::syntax_option_type e2 = std::regex_constants::nosubs;
108     e1 = ~e1;
109     e1 = e1 & e2;
110     e1 = e1 | e2;
111     e1 = e1 ^ e2;
112     e1 &= e2;
113     e1 |= e2;
114     e1 ^= e2;
115 }
116