]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/28_regex/regression.cc
Daily bump.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 28_regex / regression.cc
CommitLineData
52066eae 1// { dg-do run { target c++11 } }
cae4063c
TS
2
3//
818ab71a 4// Copyright (C) 2015-2016 Free Software Foundation, Inc.
cae4063c
TS
5//
6// This file is part of the GNU ISO C++ Library. This library is free
7// software; you can redistribute it and/or modify it under the
8// terms of the GNU General Public License as published by the
9// Free Software Foundation; either version 3, or (at your option)
10// any later version.
11//
12// This library is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License along
18// with this library; see the file COPYING3. If not see
19// <http://www.gnu.org/licenses/>.
20
21#include <testsuite_hooks.h>
22#include <testsuite_regex.h>
23
24using namespace __gnu_test;
25using namespace std;
26
27// PR libstdc++/67362
28void
29test01()
30{
31 bool test __attribute__((unused)) = true;
32
33 regex re("((.)", regex_constants::basic);
34}
35
244901a5
TS
36void
37test02()
38{
39 bool test __attribute__((unused)) = true;
40
41 std::string re_str
42 {
43 "/abcd" "\n"
44 "/aecf" "\n"
45 "/ghci"
46 };
47 auto rx = std::regex(re_str, std::regex_constants::grep | std::regex_constants::icase);
216f7526
TS
48 VERIFY(regex_search_debug("/abcd", rx));
49}
50
51void
52test03()
53{
54 bool test __attribute__((unused)) = true;
55
56 VERIFY(regex_match_debug("a.", regex(R"(a\b.)"), regex_constants::match_not_eow));
57 VERIFY(regex_match_debug(".a", regex(R"(.\ba)"), regex_constants::match_not_bow));
58 VERIFY(regex_search_debug("a", regex(R"(^\b)")));
59 VERIFY(regex_search_debug("a", regex(R"(\b$)")));
60 VERIFY(!regex_search_debug("a", regex(R"(^\b)"), regex_constants::match_not_bow));
61 VERIFY(!regex_search_debug("a", regex(R"(\b$)"), regex_constants::match_not_eow));
244901a5
TS
62}
63
cae4063c
TS
64int
65main()
66{
67 test01();
244901a5 68 test02();
216f7526 69 test03();
cae4063c
TS
70 return 0;
71}
72