diff options
author | timshen <timshen@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-02 22:20:56 +0000 |
---|---|---|
committer | timshen <timshen@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-02 22:20:56 +0000 |
commit | 094a5031d6ac73f3817104ed80bf80f2d8810b2c (patch) | |
tree | 35679ea7831ed6df022d4a35fa92b9b36166cb35 /libstdc++-v3/testsuite/28_regex | |
parent | 8b8cc022d08cfe154ff4dcfbeb4fc0cb41e11c45 (diff) | |
download | gcc-094a5031d6ac73f3817104ed80bf80f2d8810b2c.tar.gz |
2013-09-02 Tim Shen <timshen91@gmail.com>
* regex_automaton.h: Rearrange _NFA's layout.
* include/bits/regex_compiler.h: Add _AnyMatcher and _CharMatcher.
Rearrange _BracketMatcher's layout.
(_BracketMatcher<>::_M_add_char): Use set instead of vector for
_M_char_set.
(_BracketMatcher<>::_M_add_collating_element): Likewise.
(_BracketMatcher<>::_M_make_range): Likewise.
* include/bits/regex_compiler.tcc (_Compiler<>::_M_atom): Use
apropriate constructors of matchers above.
* testsuite/28_regex/algorithms/regex_match/ecma/char/anymatcher.cc:
New.
* testsuite/28_regex/algorithms/regex_match/ecma/char/backref.cc: New.
* testsuite/28_regex/algorithms/regex_match/ecma/char/empty_range.cc:
New.
* testsuite/28_regex/algorithms/regex_match/ecma/char/emptygroup.cc:
New.
* testsuite/28_regex/algorithms/regex_match/ecma/char/hex.cc: New.
* testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/anymatcher.cc:
New.
* testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/hex.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202189 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/28_regex')
-rw-r--r-- | libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/anymatcher.cc | 52 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/backref.cc (renamed from libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/string_backref.cc) | 2 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/empty_range.cc (renamed from libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/empty_range.cc) | 2 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/emptygroup.cc (renamed from libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/cstring_emptygroup.cc) | 2 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/hex.cc (renamed from libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/cstring_hex.cc) | 3 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/anymatcher.cc | 51 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/hex.cc | 44 |
7 files changed, 151 insertions, 5 deletions
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/anymatcher.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/anymatcher.cc new file mode 100644 index 00000000000..6e6095b8f24 --- /dev/null +++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/anymatcher.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++11" } + +// +// 2013-09-02 Tim Shen <timshen91@gmail.com> +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// 28.11.2 regex_match +// Tests ECMAScript "." against a std::string. + +#include <regex> +#include <testsuite_hooks.h> + +using namespace std; + +void +test01() +{ + bool test __attribute__((unused)) = true; + +#define TEST(res, s) \ + {\ + regex re(res);\ + string st(s);\ + VERIFY(!regex_match(st, re));\ + } + TEST(".", "\0"); + TEST(".", "\n"); + TEST(".", "\r"); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/string_backref.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/backref.cc index a828fea93c6..321ce35a038 100644 --- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/string_backref.cc +++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/backref.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // -// 2013-08-10 Tim Shen <timshen91@gmail.com> +// 2013-09-02 Tim Shen <timshen91@gmail.com> // // Copyright (C) 2013 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/empty_range.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/empty_range.cc index 93bca45bf9d..3c48d3521a5 100644 --- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/empty_range.cc +++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/empty_range.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // -// 2013-08-26 Tim Shen <timshen91@gmail.com> +// 2013-09-02 Tim Shen <timshen91@gmail.com> // // Copyright (C) 2013 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/cstring_emptygroup.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/emptygroup.cc index e112db55e4a..1dc8f63f789 100644 --- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/cstring_emptygroup.cc +++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/emptygroup.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // -// 2013-08-22 Tim Shen <timshen91@gmail.com> +// 2013-09-02 Tim Shen <timshen91@gmail.com> // // Copyright (C) 2013 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/cstring_hex.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/hex.cc index a7ef0fb36cc..a73b742a5e4 100644 --- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/cstring_hex.cc +++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/hex.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++11" } // -// 2013-08-26 Tim Shen <timshen91@gmail.com> +// 2013-09-02 Tim Shen <timshen91@gmail.com> // // Copyright (C) 2013 Free Software Foundation, Inc. // @@ -34,7 +34,6 @@ test01() bool test __attribute__((unused)) = true; VERIFY(regex_match(":", regex("\\x3a"))); - VERIFY(regex_match(L"\u1234", wregex(L"\\u1234"))); try { regex("\\u400x"); diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/anymatcher.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/anymatcher.cc new file mode 100644 index 00000000000..c574908d6a9 --- /dev/null +++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/anymatcher.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++11" } + +// +// 2013-09-02 Tim Shen <timshen91@gmail.com> +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// 28.11.2 regex_match +// Tests ECMAScript "." against a std::string. + +#include <regex> +#include <testsuite_hooks.h> + +using namespace std; + +void +test01() +{ + bool test __attribute__((unused)) = true; + +#define TESTL(res, s) \ + {\ + wregex re(res);\ + wstring st(s);\ + VERIFY(!regex_match(st, re));\ + } + TESTL(L".", L"\u2028"); + TESTL(L".", L"\u2029"); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/hex.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/hex.cc new file mode 100644 index 00000000000..f9561be70e2 --- /dev/null +++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/hex.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++11" } + +// +// 2013-09-02 Tim Shen <timshen91@gmail.com> +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// 28.11.2 regex_match +// Tests ECMAScript \x and \u. + +#include <regex> +#include <testsuite_hooks.h> + +using namespace std; + +void +test01() +{ + bool test __attribute__((unused)) = true; + + VERIFY(regex_match(L"\u1234", wregex(L"\\u1234"))); +} + +int +main() +{ + test01(); + return 0; +} |