Emit vmov.i64 to load 0.0 into FP reg when neon enabled.
[official-gcc.git] / libstdc++-v3 / testsuite / 28_regex / match_results / out_of_range_submatches.cc
blobcad0c82600797163fc1ada9ed12e014f48b4d80f
1 // { dg-options "-std=gnu++11" }
3 // Copyright (C) 2015-2016 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
20 #include <regex>
21 #include <testsuite_hooks.h>
22 #include <testsuite_regex.h>
24 using namespace std;
25 using namespace __gnu_test;
27 // libstdc++/64441
28 void
29 test01()
31 bool test __attribute__((unused)) = true;
33 const char s[] = "abc";
34 const std::regex re("(\\d+)|(\\w+)");
36 std::cmatch m;
37 VERIFY(regex_search_debug(s, m, re));
39 std::tuple<bool, string, int, int> expected[] = {
40 make_tuple(true, "abc", 0, 3),
41 make_tuple(false, "", 3, 3),
42 make_tuple(true, "abc", 0, 3),
43 make_tuple(false, "", 3, 3),
45 for (size_t i = 0, n = m.size(); i <= n; ++i) {
46 auto&& sub = m[i];
47 VERIFY(sub.matched == std::get<0>(expected[i]));
48 VERIFY(sub.str() == std::get<1>(expected[i]));
49 VERIFY((sub.first - s) == std::get<2>(expected[i]));
50 VERIFY((sub.second - s) == std::get<3>(expected[i]));
54 // libstdc++/64781
55 void
56 test02()
58 bool test __attribute__((unused)) = true;
60 std::match_results<const char*> m;
61 const char s[] = "a";
62 VERIFY(regex_search_debug(s, m, std::regex("a")));
64 VERIFY(m.size() == 1);
66 VERIFY(m[0].first == s+0);
67 VERIFY(m[0].second == s+1);
68 VERIFY(m[0].matched == true);
70 VERIFY(m[42].first == s+1);
71 VERIFY(m[42].second == s+1);
72 VERIFY(m[42].matched == false);
75 int
76 main()
78 test01();
79 test02();
80 return 0;