]>
Commit | Line | Data |
---|---|---|
52066eae | 1 | // { dg-do run { target c++11 } } |
b6a8e347 | 2 | // { dg-timeout-factor 2 } |
d2e0c00b | 3 | // { dg-additional-options "-DNEWLINE_IN_CLASS_BLANK" { target newlib } } |
523ca640 | 4 | // { dg-additional-options "-DNEWLINE_IN_CLASS_BLANK" { target *-vxworks*-* } } |
d2e0c00b JW |
5 | |
6 | // | |
7 | // 2010-06-23 Stephen M. Webb <stephen.webb@bregmasoft.ca> | |
849cab7b | 8 | // |
83ffe9cd | 9 | // Copyright (C) 2010-2023 Free Software Foundation, Inc. |
849cab7b SW |
10 | // |
11 | // This file is part of the GNU ISO C++ Library. This library is free | |
12 | // software; you can redistribute it and/or modify it under the | |
13 | // terms of the GNU General Public License as published by the | |
14 | // Free Software Foundation; either version 3, or (at your option) | |
15 | // any later version. | |
16 | // | |
17 | // This library is distributed in the hope that it will be useful, | |
18 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | // GNU General Public License for more details. | |
21 | // | |
22 | // You should have received a copy of the GNU General Public License along | |
23 | // with this library; see the file COPYING3. If not see | |
24 | // <http://www.gnu.org/licenses/>. | |
25 | ||
26 | // 28.3 Requirements [re.req] | |
27 | // 28.2(4) Table 127 - Regular expression traits class requirements | |
28 | // 28.7(11) Class template regex_traits [re.traits] | |
29 | ||
30 | #include <regex> | |
31 | #include <testsuite_hooks.h> | |
32 | ||
33 | void | |
34 | test01() | |
35 | { | |
849cab7b SW |
36 | typedef char CharT; |
37 | typedef std::regex_traits<CharT> traits; | |
38 | ||
b3ebe3d0 TS |
39 | const CharT lower[] = "lOWer"; |
40 | const CharT upper[] = "UPPER"; | |
41 | const CharT nothing[] = "nothing"; | |
42 | const CharT word[] = "w"; | |
43 | const CharT blank[] = "blank"; | |
44 | const CharT digit[] = "digit"; | |
45 | traits t; | |
849cab7b | 46 | |
b3ebe3d0 TS |
47 | #define range(s) s, s+sizeof(s)/sizeof(s[0])-1 |
48 | VERIFY( t.isctype('_', t.lookup_classname(range(word)))); | |
49 | VERIFY( t.isctype('A', t.lookup_classname(range(word)))); | |
50 | VERIFY(!t.isctype('~', t.lookup_classname(range(word)))); | |
51 | VERIFY(!t.isctype('e', t.lookup_classname(range(upper)))); | |
52 | VERIFY( t.isctype('e', t.lookup_classname(range(lower)))); | |
53 | VERIFY(!t.isctype('e', t.lookup_classname(range(nothing)))); | |
1e0c223f MW |
54 | VERIFY(!t.isctype('_', t.lookup_classname(range(digit)))); |
55 | VERIFY( t.isctype(' ', t.lookup_classname(range(blank)))); | |
56 | VERIFY( t.isctype('\t', t.lookup_classname(range(blank)))); | |
d2e0c00b | 57 | #if !defined (NEWLINE_IN_CLASS_BLANK) |
b3ebe3d0 | 58 | VERIFY(!t.isctype('\n', t.lookup_classname(range(blank)))); |
ff9eac29 | 59 | #endif |
b3ebe3d0 TS |
60 | VERIFY( t.isctype('t', t.lookup_classname(range(upper), true))); |
61 | VERIFY( t.isctype('T', t.lookup_classname(range(lower), true))); | |
62 | #undef range | |
849cab7b SW |
63 | } |
64 | ||
65 | int main() | |
66 | { | |
67 | test01(); | |
68 | return 0; | |
69 | } |