]>
Commit | Line | Data |
---|---|---|
72900b83 MW |
1 | // { dg-do run }\r |
2 | // { dg-options "-std=gnu++11" }\r | |
3 | // { dg-additional-options "-DNEWLINE_IN_CLASS_BLANK" { target newlib } }\r | |
4 | \r | |
5 | // Copyright (C) 2010-2015 Free Software Foundation, Inc.\r | |
6 | //\r | |
b3ebe3d0 TS |
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.3 Requirements [re.req] | |
23 | // 28.2(4) Table 127 - Regular expression traits class requirements | |
24 | // 28.7(11) Class template regex_traits [re.traits] | |
25 | ||
26 | #include <regex> | |
27 | #include <testsuite_hooks.h> | |
28 | ||
29 | void | |
30 | test01() | |
31 | { | |
32 | bool test __attribute__((unused)) = true; | |
33 | typedef wchar_t CharT; | |
34 | typedef std::regex_traits<CharT> traits; | |
35 | ||
36 | const CharT lower[] = L"lOWer"; | |
37 | const CharT upper[] = L"UPPER"; | |
38 | const CharT nothing[] = L"nothing"; | |
39 | const CharT word[] = L"w"; | |
40 | const CharT blank[] = L"blank"; | |
41 | const CharT digit[] = L"digit"; | |
42 | traits t; | |
43 | ||
44 | #define range(s) s, s+sizeof(s)/sizeof(s[0])-1 | |
45 | VERIFY( t.isctype(L'_', t.lookup_classname(range(word)))); | |
46 | VERIFY( t.isctype(L'A', t.lookup_classname(range(word)))); | |
47 | VERIFY(!t.isctype(L'~', t.lookup_classname(range(word)))); | |
48 | VERIFY(!t.isctype(L'e', t.lookup_classname(range(upper)))); | |
49 | VERIFY( t.isctype(L'e', t.lookup_classname(range(lower)))); | |
50 | VERIFY(!t.isctype(L'e', t.lookup_classname(range(nothing)))); | |
72900b83 MW |
51 | VERIFY(!t.isctype(L'_', t.lookup_classname(range(digit))));\r |
52 | VERIFY( t.isctype(L' ', t.lookup_classname(range(blank))));\r | |
53 | VERIFY( t.isctype(L'\t', t.lookup_classname(range(blank))));\r | |
54 | #if defined (NEWLINE_IN_CLASS_BLANK)\r | |
55 | /* On some targets, '\n' is in class 'blank'.\r | |
56 | See https://gcc.gnu.org/ml/gcc-patches/2015-02/msg00059.html. */\r | |
57 | VERIFY( t.isctype(L'\n', t.lookup_classname(range(blank))));\r | |
58 | #else VERIFY(!t.isctype(L'\n', t.lookup_classname(range(blank)))); | |
ff9eac29 | 59 | #endif |
b3ebe3d0 TS |
60 | VERIFY( t.isctype(L't', t.lookup_classname(range(upper), true))); |
61 | VERIFY( t.isctype(L'T', t.lookup_classname(range(lower), true))); | |
62 | #undef range | |
63 | } | |
64 | ||
65 | int main() | |
66 | { | |
67 | test01(); | |
68 | return 0; | |
69 | } |