summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/wchar_t/string_01.cc
diff options
context:
space:
mode:
authortimshen <timshen@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-23 12:31:51 +0000
committertimshen <timshen@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-23 12:31:51 +0000
commitb54ba0cbc4849d8dd28ebb99616e327887182f3d (patch)
treee835627101effffddb47426eb2e8821eba0f6953 /libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/wchar_t/string_01.cc
parent1ae2a9c0b05d8922718ae12dfb7337b344c8a1c7 (diff)
downloadgcc-b54ba0cbc4849d8dd28ebb99616e327887182f3d.tar.gz
2013-07-23 Tim Shen <timshen91@gmail.com>
Implement regex_iterator and regex_token_iterator. * include/bits/regex.h: regex_iterator and regex_token_iterator. * testsuite/28_regex/iterators/regex_iterator/char/string_01.cc: New. * testsuite/28_regex/iterators/regex_iterator/wchar_t/string_01.cc: New. * testsuite/28_regex/iterators/regex_token_iterator/char/string_01.cc: New. * testsuite/28_regex/iterators/regex_token_iterator/wchar_t/string_01.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201169 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/wchar_t/string_01.cc')
-rw-r--r--libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/wchar_t/string_01.cc52
1 files changed, 52 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/wchar_t/string_01.cc b/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/wchar_t/string_01.cc
new file mode 100644
index 00000000000..1b6e9a5464f
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/wchar_t/string_01.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++11" }
+
+//
+// 2013-07-20 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.12.1 regex_iterator
+// Tests operator++() of regex_iterator class
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::basic_regex<wchar_t> re(L"asdf");
+ const wchar_t s[] = L"ffasdf88asdf99asdf00asdf77";
+ int cnt = 0;
+ for (std::regex_iterator<const wchar_t*> it(s, *(&s+1)-1, re), e;
+ it != e; ++it)
+ {
+ VERIFY( it->size() == 1 );
+ VERIFY( std::wstring((*it)[0].first, (*it)[0].second) == L"asdf" );
+ cnt++;
+ }
+ VERIFY( cnt == 4 );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}