[cfe-commits] [libcxx] r110955 - in /libcxx/trunk: include/ test/re/re.regex/re.regex.construct/ test/re/re.syn/

Howard Hinnant hhinnant at apple.com
Thu Aug 12 14:14:20 PDT 2010


Author: hhinnant
Date: Thu Aug 12 16:14:20 2010
New Revision: 110955

URL: http://llvm.org/viewvc/llvm-project?rev=110955&view=rev
Log:
Filling out regex tests...

Added:
    libcxx/trunk/test/re/re.regex/re.regex.construct/il_flg.pass.cpp
    libcxx/trunk/test/re/re.regex/re.regex.construct/iter_iter.pass.cpp
    libcxx/trunk/test/re/re.regex/re.regex.construct/iter_iter_flg.pass.cpp
    libcxx/trunk/test/re/re.regex/re.regex.construct/ptr.pass.cpp
    libcxx/trunk/test/re/re.regex/re.regex.construct/ptr_size_flg.pass.cpp
    libcxx/trunk/test/re/re.regex/re.regex.construct/string.pass.cpp
    libcxx/trunk/test/re/re.regex/re.regex.construct/string_flg.pass.cpp
    libcxx/trunk/test/re/re.syn/cmatch.pass.cpp
    libcxx/trunk/test/re/re.syn/cregex_iterator.pass.cpp
    libcxx/trunk/test/re/re.syn/cregex_token_iterator.pass.cpp
    libcxx/trunk/test/re/re.syn/csub_match.pass.cpp
    libcxx/trunk/test/re/re.syn/regex.pass.cpp
    libcxx/trunk/test/re/re.syn/smatch.pass.cpp
    libcxx/trunk/test/re/re.syn/sregex_iterator.pass.cpp
    libcxx/trunk/test/re/re.syn/sregex_token_iterator.pass.cpp
    libcxx/trunk/test/re/re.syn/ssub_match.pass.cpp
    libcxx/trunk/test/re/re.syn/wcmatch.pass.cpp
    libcxx/trunk/test/re/re.syn/wcregex_iterator.pass.cpp
    libcxx/trunk/test/re/re.syn/wcregex_token_iterator.pass.cpp
    libcxx/trunk/test/re/re.syn/wcsub_match.pass.cpp
    libcxx/trunk/test/re/re.syn/wregex.pass.cpp
    libcxx/trunk/test/re/re.syn/wsmatch.pass.cpp
    libcxx/trunk/test/re/re.syn/wsregex_iterator.pass.cpp
    libcxx/trunk/test/re/re.syn/wsregex_token_iterator.pass.cpp
    libcxx/trunk/test/re/re.syn/wssub_match.pass.cpp
Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/test/re/re.regex/re.regex.construct/ptr_flg.pass.cpp

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=110955&r1=110954&r2=110955&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Thu Aug 12 16:14:20 2010
@@ -143,10 +143,6 @@
 #define _LIBCPP_NO_EXCEPTIONS
 #endif
 
-#ifndef __GXX_RTTI
-#define _LIBCPP_NO_RTTI
-#endif
-
 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
 
 #ifndef __GXX_EXPERIMENTAL_CXX0X__

Added: libcxx/trunk/test/re/re.regex/re.regex.construct/il_flg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.regex/re.regex.construct/il_flg.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.regex/re.regex.construct/il_flg.pass.cpp (added)
+++ libcxx/trunk/test/re/re.regex/re.regex.construct/il_flg.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT, class traits = regex_traits<charT>> class basic_regex;
+
+// basic_regex(initializer_list<charT> il,
+//             flag_type f = regex_constants::ECMAScript);
+
+#include <regex>
+#include <cassert>
+
+#ifdef _LIBCPP_MOVE
+
+void
+test(std::initializer_list<char> il, std::regex_constants::syntax_option_type f, unsigned mc)
+{
+    std::basic_regex<char> r(il, f);
+    assert(r.flags() == f);
+    assert(r.mark_count() == mc);
+}
+
+#endif
+
+int main()
+{
+#ifdef _LIBCPP_MOVE
+    std::string s1("\\(a\\)");
+    std::string s2("\\(a[bc]\\)");
+    std::string s3("\\(a\\([bc]\\)\\)");
+    std::string s4("(a([bc]))");
+
+    test({'\\', '(', 'a', '\\', ')'}, std::regex_constants::basic, 1);
+    test({'\\', '(', 'a', '[', 'b', 'c', ']', '\\', ')'}, std::regex_constants::basic, 1);
+    test({'\\', '(', 'a', '\\', '(', '[', 'b', 'c', ']', '\\', ')', '\\', ')'}, std::regex_constants::basic, 2);
+    test({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex_constants::basic, 0);
+
+    test({'\\', '(', 'a', '\\', ')'}, std::regex_constants::extended, 0);
+    test({'\\', '(', 'a', '[', 'b', 'c', ']', '\\', ')'}, std::regex_constants::extended, 0);
+    test({'\\', '(', 'a', '\\', '(', '[', 'b', 'c', ']', '\\', ')', '\\', ')'}, std::regex_constants::extended, 0);
+    test({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex_constants::extended, 2);
+
+    test({'\\', '(', 'a', '\\', ')'}, std::regex_constants::ECMAScript, 0);
+    test({'\\', '(', 'a', '[', 'b', 'c', ']', '\\', ')'}, std::regex_constants::ECMAScript, 0);
+    test({'\\', '(', 'a', '\\', '(', '[', 'b', 'c', ']', '\\', ')', '\\', ')'}, std::regex_constants::ECMAScript, 0);
+    test({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex_constants::ECMAScript, 2);
+
+    test({'\\', '(', 'a', '\\', ')'}, std::regex_constants::awk, 0);
+    test({'\\', '(', 'a', '[', 'b', 'c', ']', '\\', ')'}, std::regex_constants::awk, 0);
+    test({'\\', '(', 'a', '\\', '(', '[', 'b', 'c', ']', '\\', ')', '\\', ')'}, std::regex_constants::awk, 0);
+    test({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex_constants::awk, 2);
+
+    test({'\\', '(', 'a', '\\', ')'}, std::regex_constants::grep, 1);
+    test({'\\', '(', 'a', '[', 'b', 'c', ']', '\\', ')'}, std::regex_constants::grep, 1);
+    test({'\\', '(', 'a', '\\', '(', '[', 'b', 'c', ']', '\\', ')', '\\', ')'}, std::regex_constants::grep, 2);
+    test({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex_constants::grep, 0);
+
+    test({'\\', '(', 'a', '\\', ')'}, std::regex_constants::egrep, 0);
+    test({'\\', '(', 'a', '[', 'b', 'c', ']', '\\', ')'}, std::regex_constants::egrep, 0);
+    test({'\\', '(', 'a', '\\', '(', '[', 'b', 'c', ']', '\\', ')', '\\', ')'}, std::regex_constants::egrep, 0);
+    test({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex_constants::egrep, 2);
+#endif
+}

Added: libcxx/trunk/test/re/re.regex/re.regex.construct/iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.regex/re.regex.construct/iter_iter.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.regex/re.regex.construct/iter_iter.pass.cpp (added)
+++ libcxx/trunk/test/re/re.regex/re.regex.construct/iter_iter.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT, class traits = regex_traits<charT>> class basic_regex;
+
+// template <class ForwardIterator>
+//    basic_regex(ForwardIterator first, ForwardIterator last);
+
+#include <regex>
+#include <cassert>
+
+#include "../../iterators.h"
+
+template <class Iter>
+void
+test(Iter first, Iter last, unsigned mc)
+{
+    std::basic_regex<typename std::iterator_traits<Iter>::value_type> r(first, last);
+    assert(r.flags() == std::regex_constants::ECMAScript);
+    assert(r.mark_count() == mc);
+}
+
+int main()
+{
+    typedef forward_iterator<std::string::const_iterator> F;
+    std::string s1("\\(a\\)");
+    std::string s2("\\(a[bc]\\)");
+    std::string s3("\\(a\\([bc]\\)\\)");
+    std::string s4("(a([bc]))");
+
+    test(F(s1.begin()), F(s1.end()), 0);
+    test(F(s2.begin()), F(s2.end()), 0);
+    test(F(s3.begin()), F(s3.end()), 0);
+    test(F(s4.begin()), F(s4.end()), 2);
+}

Added: libcxx/trunk/test/re/re.regex/re.regex.construct/iter_iter_flg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.regex/re.regex.construct/iter_iter_flg.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.regex/re.regex.construct/iter_iter_flg.pass.cpp (added)
+++ libcxx/trunk/test/re/re.regex/re.regex.construct/iter_iter_flg.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT, class traits = regex_traits<charT>> class basic_regex;
+
+// template <class ForwardIterator>
+//    basic_regex(ForwardIterator first, ForwardIterator last,
+//                flag_type f = regex_constants::ECMAScript);
+
+#include <regex>
+#include <cassert>
+
+#include "../../iterators.h"
+
+template <class Iter>
+void
+test(Iter first, Iter last, std::regex_constants::syntax_option_type f, unsigned mc)
+{
+    std::basic_regex<typename std::iterator_traits<Iter>::value_type> r(first, last, f);
+    assert(r.flags() == f);
+    assert(r.mark_count() == mc);
+}
+
+int main()
+{
+    typedef forward_iterator<std::string::const_iterator> F;
+    std::string s1("\\(a\\)");
+    std::string s2("\\(a[bc]\\)");
+    std::string s3("\\(a\\([bc]\\)\\)");
+    std::string s4("(a([bc]))");
+
+    test(F(s1.begin()), F(s1.end()), std::regex_constants::basic, 1);
+    test(F(s2.begin()), F(s2.end()), std::regex_constants::basic, 1);
+    test(F(s3.begin()), F(s3.end()), std::regex_constants::basic, 2);
+    test(F(s4.begin()), F(s4.end()), std::regex_constants::basic, 0);
+
+    test(F(s1.begin()), F(s1.end()), std::regex_constants::extended, 0);
+    test(F(s2.begin()), F(s2.end()), std::regex_constants::extended, 0);
+    test(F(s3.begin()), F(s3.end()), std::regex_constants::extended, 0);
+    test(F(s4.begin()), F(s4.end()), std::regex_constants::extended, 2);
+
+    test(F(s1.begin()), F(s1.end()), std::regex_constants::ECMAScript, 0);
+    test(F(s2.begin()), F(s2.end()), std::regex_constants::ECMAScript, 0);
+    test(F(s3.begin()), F(s3.end()), std::regex_constants::ECMAScript, 0);
+    test(F(s4.begin()), F(s4.end()), std::regex_constants::ECMAScript, 2);
+
+    test(F(s1.begin()), F(s1.end()), std::regex_constants::awk, 0);
+    test(F(s2.begin()), F(s2.end()), std::regex_constants::awk, 0);
+    test(F(s3.begin()), F(s3.end()), std::regex_constants::awk, 0);
+    test(F(s4.begin()), F(s4.end()), std::regex_constants::awk, 2);
+
+    test(F(s1.begin()), F(s1.end()), std::regex_constants::grep, 1);
+    test(F(s2.begin()), F(s2.end()), std::regex_constants::grep, 1);
+    test(F(s3.begin()), F(s3.end()), std::regex_constants::grep, 2);
+    test(F(s4.begin()), F(s4.end()), std::regex_constants::grep, 0);
+
+    test(F(s1.begin()), F(s1.end()), std::regex_constants::egrep, 0);
+    test(F(s2.begin()), F(s2.end()), std::regex_constants::egrep, 0);
+    test(F(s3.begin()), F(s3.end()), std::regex_constants::egrep, 0);
+    test(F(s4.begin()), F(s4.end()), std::regex_constants::egrep, 2);
+}

Added: libcxx/trunk/test/re/re.regex/re.regex.construct/ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.regex/re.regex.construct/ptr.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.regex/re.regex.construct/ptr.pass.cpp (added)
+++ libcxx/trunk/test/re/re.regex/re.regex.construct/ptr.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT, class traits = regex_traits<charT>> class basic_regex;
+
+// basic_regex(const charT* p);
+
+#include <iostream>
+
+#include <regex>
+#include <cassert>
+
+template <class CharT>
+void
+test(const CharT* p, unsigned mc)
+{
+    std::basic_regex<CharT> r(p);
+    assert(r.flags() == std::regex_constants::ECMAScript);
+    assert(r.mark_count() == mc);
+}
+
+int main()
+{
+    test("\\(a\\)", 0);
+    test("\\(a[bc]\\)", 0);
+    test("\\(a\\([bc]\\)\\)", 0);
+    test("(a([bc]))", 2);
+}

Modified: libcxx/trunk/test/re/re.regex/re.regex.construct/ptr_flg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.regex/re.regex.construct/ptr_flg.pass.cpp?rev=110955&r1=110954&r2=110955&view=diff
==============================================================================
--- libcxx/trunk/test/re/re.regex/re.regex.construct/ptr_flg.pass.cpp (original)
+++ libcxx/trunk/test/re/re.regex/re.regex.construct/ptr_flg.pass.cpp Thu Aug 12 16:14:20 2010
@@ -29,9 +29,33 @@
 
 int main()
 {
-    test("", std::regex_constants::basic, 0);
     test("\\(a\\)", std::regex_constants::basic, 1);
     test("\\(a[bc]\\)", std::regex_constants::basic, 1);
     test("\\(a\\([bc]\\)\\)", std::regex_constants::basic, 2);
     test("(a([bc]))", std::regex_constants::basic, 0);
+
+    test("\\(a\\)", std::regex_constants::extended, 0);
+    test("\\(a[bc]\\)", std::regex_constants::extended, 0);
+    test("\\(a\\([bc]\\)\\)", std::regex_constants::extended, 0);
+    test("(a([bc]))", std::regex_constants::extended, 2);
+
+    test("\\(a\\)", std::regex_constants::ECMAScript, 0);
+    test("\\(a[bc]\\)", std::regex_constants::ECMAScript, 0);
+    test("\\(a\\([bc]\\)\\)", std::regex_constants::ECMAScript, 0);
+    test("(a([bc]))", std::regex_constants::ECMAScript, 2);
+
+    test("\\(a\\)", std::regex_constants::awk, 0);
+    test("\\(a[bc]\\)", std::regex_constants::awk, 0);
+    test("\\(a\\([bc]\\)\\)", std::regex_constants::awk, 0);
+    test("(a([bc]))", std::regex_constants::awk, 2);
+
+    test("\\(a\\)", std::regex_constants::grep, 1);
+    test("\\(a[bc]\\)", std::regex_constants::grep, 1);
+    test("\\(a\\([bc]\\)\\)", std::regex_constants::grep, 2);
+    test("(a([bc]))", std::regex_constants::grep, 0);
+
+    test("\\(a\\)", std::regex_constants::egrep, 0);
+    test("\\(a[bc]\\)", std::regex_constants::egrep, 0);
+    test("\\(a\\([bc]\\)\\)", std::regex_constants::egrep, 0);
+    test("(a([bc]))", std::regex_constants::egrep, 2);
 }

Added: libcxx/trunk/test/re/re.regex/re.regex.construct/ptr_size_flg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.regex/re.regex.construct/ptr_size_flg.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.regex/re.regex.construct/ptr_size_flg.pass.cpp (added)
+++ libcxx/trunk/test/re/re.regex/re.regex.construct/ptr_size_flg.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT, class traits = regex_traits<charT>> class basic_regex;
+
+// basic_regex(const charT* p, size_t len, flag_type f);
+
+#include <regex>
+#include <cassert>
+
+template <class CharT>
+void
+test(const CharT* p, std::size_t len, std::regex_constants::syntax_option_type f,
+     unsigned mc)
+{
+    std::basic_regex<CharT> r(p, len, f);
+    assert(r.flags() == f);
+    assert(r.mark_count() == mc);
+}
+
+int main()
+{
+    test("\\(a\\)", 5, std::regex_constants::basic, 1);
+    test("\\(a[bc]\\)", 9, std::regex_constants::basic, 1);
+    test("\\(a\\([bc]\\)\\)", 13, std::regex_constants::basic, 2);
+    test("(a([bc]))", 9, std::regex_constants::basic, 0);
+
+    test("\\(a\\)", 5, std::regex_constants::extended, 0);
+    test("\\(a[bc]\\)", 9, std::regex_constants::extended, 0);
+    test("\\(a\\([bc]\\)\\)", 13, std::regex_constants::extended, 0);
+    test("(a([bc]))", 9, std::regex_constants::extended, 2);
+
+    test("\\(a\\)", 5, std::regex_constants::ECMAScript, 0);
+    test("\\(a[bc]\\)", 9, std::regex_constants::ECMAScript, 0);
+    test("\\(a\\([bc]\\)\\)", 13, std::regex_constants::ECMAScript, 0);
+    test("(a([bc]))", 9, std::regex_constants::ECMAScript, 2);
+
+    test("\\(a\\)", 5, std::regex_constants::awk, 0);
+    test("\\(a[bc]\\)", 9, std::regex_constants::awk, 0);
+    test("\\(a\\([bc]\\)\\)", 13, std::regex_constants::awk, 0);
+    test("(a([bc]))", 9, std::regex_constants::awk, 2);
+
+    test("\\(a\\)", 5, std::regex_constants::grep, 1);
+    test("\\(a[bc]\\)", 9, std::regex_constants::grep, 1);
+    test("\\(a\\([bc]\\)\\)", 13, std::regex_constants::grep, 2);
+    test("(a([bc]))", 9, std::regex_constants::grep, 0);
+
+    test("\\(a\\)", 5, std::regex_constants::egrep, 0);
+    test("\\(a[bc]\\)", 9, std::regex_constants::egrep, 0);
+    test("\\(a\\([bc]\\)\\)", 13, std::regex_constants::egrep, 0);
+    test("(a([bc]))", 9, std::regex_constants::egrep, 2);
+}

Added: libcxx/trunk/test/re/re.regex/re.regex.construct/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.regex/re.regex.construct/string.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.regex/re.regex.construct/string.pass.cpp (added)
+++ libcxx/trunk/test/re/re.regex/re.regex.construct/string.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT, class traits = regex_traits<charT>> class basic_regex;
+
+// template <class ST, class SA>
+//    basic_regex(const basic_string<charT, ST, SA>& s);
+
+#include <regex>
+#include <cassert>
+
+template <class String>
+void
+test(const String& p, unsigned mc)
+{
+    std::basic_regex<typename String::value_type> r(p);
+    assert(r.flags() == std::regex_constants::ECMAScript);
+    assert(r.mark_count() == mc);
+}
+
+int main()
+{
+    test(std::string("\\(a\\)"), 0);
+    test(std::string("\\(a[bc]\\)"), 0);
+    test(std::string("\\(a\\([bc]\\)\\)"), 0);
+    test(std::string("(a([bc]))"), 2);
+}

Added: libcxx/trunk/test/re/re.regex/re.regex.construct/string_flg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.regex/re.regex.construct/string_flg.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.regex/re.regex.construct/string_flg.pass.cpp (added)
+++ libcxx/trunk/test/re/re.regex/re.regex.construct/string_flg.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT, class traits = regex_traits<charT>> class basic_regex;
+
+// template <class ST, class SA>
+//    basic_regex(const basic_string<charT, ST, SA>& s,
+//                flag_type f = regex_constants::ECMAScript);
+
+#include <iostream>
+
+#include <regex>
+#include <cassert>
+
+template <class String>
+void
+test(const String& p, std::regex_constants::syntax_option_type f, unsigned mc)
+{
+    std::basic_regex<typename String::value_type> r(p, f);
+    assert(r.flags() == f);
+    assert(r.mark_count() == mc);
+}
+
+int main()
+{
+    test(std::string("\\(a\\)"), std::regex_constants::basic, 1);
+    test(std::string("\\(a[bc]\\)"), std::regex_constants::basic, 1);
+    test(std::string("\\(a\\([bc]\\)\\)"), std::regex_constants::basic, 2);
+    test(std::string("(a([bc]))"), std::regex_constants::basic, 0);
+
+    test(std::string("\\(a\\)"), std::regex_constants::extended, 0);
+    test(std::string("\\(a[bc]\\)"), std::regex_constants::extended, 0);
+    test(std::string("\\(a\\([bc]\\)\\)"), std::regex_constants::extended, 0);
+    test(std::string("(a([bc]))"), std::regex_constants::extended, 2);
+
+    test(std::string("\\(a\\)"), std::regex_constants::ECMAScript, 0);
+    test(std::string("\\(a[bc]\\)"), std::regex_constants::ECMAScript, 0);
+    test(std::string("\\(a\\([bc]\\)\\)"), std::regex_constants::ECMAScript, 0);
+    test(std::string("(a([bc]))"), std::regex_constants::ECMAScript, 2);
+
+    test(std::string("\\(a\\)"), std::regex_constants::awk, 0);
+    test(std::string("\\(a[bc]\\)"), std::regex_constants::awk, 0);
+    test(std::string("\\(a\\([bc]\\)\\)"), std::regex_constants::awk, 0);
+    test(std::string("(a([bc]))"), std::regex_constants::awk, 2);
+
+    test(std::string("\\(a\\)"), std::regex_constants::grep, 1);
+    test(std::string("\\(a[bc]\\)"), std::regex_constants::grep, 1);
+    test(std::string("\\(a\\([bc]\\)\\)"), std::regex_constants::grep, 2);
+    test(std::string("(a([bc]))"), std::regex_constants::grep, 0);
+
+    test(std::string("\\(a\\)"), std::regex_constants::egrep, 0);
+    test(std::string("\\(a[bc]\\)"), std::regex_constants::egrep, 0);
+    test(std::string("\\(a\\([bc]\\)\\)"), std::regex_constants::egrep, 0);
+    test(std::string("(a([bc]))"), std::regex_constants::egrep, 2);
+}

Added: libcxx/trunk/test/re/re.syn/cmatch.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/cmatch.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/cmatch.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/cmatch.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef match_results<const char*>   cmatch;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::match_results<const char*>, std::cmatch>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/cregex_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/cregex_iterator.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/cregex_iterator.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/cregex_iterator.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef regex_iterator<const char*>   cregex_iterator;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::regex_iterator<const char*>, std::cregex_iterator>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/cregex_token_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/cregex_token_iterator.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/cregex_token_iterator.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/cregex_token_iterator.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef regex_token_iterator<const char*>   cregex_token_iterator;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::regex_token_iterator<const char*>, std::cregex_token_iterator>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/csub_match.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/csub_match.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/csub_match.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/csub_match.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef sub_match<const char*>   csub_match;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::sub_match<const char*>, std::csub_match>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/regex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/regex.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/regex.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/regex.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef basic_regex<char>    regex;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::basic_regex<char>, std::regex>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/smatch.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/smatch.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/smatch.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/smatch.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef match_results<string::const_iterator>   smatch;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::match_results<std::string::const_iterator>, std::smatch>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/sregex_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/sregex_iterator.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/sregex_iterator.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/sregex_iterator.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef regex_iterator<string::const_iterator>   sregex_iterator;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::regex_iterator<std::string::const_iterator>, std::sregex_iterator>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/sregex_token_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/sregex_token_iterator.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/sregex_token_iterator.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/sregex_token_iterator.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef regex_token_iterator<string::const_iterator>   sregex_token_iterator;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::regex_token_iterator<std::string::const_iterator>, std::sregex_token_iterator>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/ssub_match.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/ssub_match.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/ssub_match.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/ssub_match.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef sub_match<string::const_iterator>   ssub_match;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::sub_match<std::string::const_iterator>, std::ssub_match>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/wcmatch.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/wcmatch.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/wcmatch.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/wcmatch.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef match_results<const wchar_t*>   wcmatch;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::match_results<const wchar_t*>, std::wcmatch>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/wcregex_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/wcregex_iterator.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/wcregex_iterator.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/wcregex_iterator.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef regex_iterator<const wchar_t*>   wcregex_iterator;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::regex_iterator<const wchar_t*>, std::wcregex_iterator>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/wcregex_token_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/wcregex_token_iterator.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/wcregex_token_iterator.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/wcregex_token_iterator.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef regex_token_iterator<const wchar_t*>   wcregex_token_iterator;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::regex_token_iterator<const wchar_t*>, std::wcregex_token_iterator>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/wcsub_match.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/wcsub_match.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/wcsub_match.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/wcsub_match.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef sub_match<const wchar_t*>   wcsub_match;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::sub_match<const wchar_t*>, std::wcsub_match>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/wregex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/wregex.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/wregex.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/wregex.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef basic_regex<wchar_t> wregex;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::basic_regex<wchar_t>, std::wregex>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/wsmatch.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/wsmatch.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/wsmatch.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/wsmatch.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef match_results<wstring::const_iterator>   wsmatch;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::match_results<std::wstring::const_iterator>, std::wsmatch>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/wsregex_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/wsregex_iterator.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/wsregex_iterator.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/wsregex_iterator.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef regex_iterator<wstring::const_iterator>   wsregex_iterator;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::regex_iterator<std::wstring::const_iterator>, std::wsregex_iterator>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/wsregex_token_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/wsregex_token_iterator.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/wsregex_token_iterator.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/wsregex_token_iterator.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef regex_token_iterator<wstring::const_iterator>   wsregex_token_iterator;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::regex_token_iterator<std::wstring::const_iterator>, std::wsregex_token_iterator>::value), "");
+}

Added: libcxx/trunk/test/re/re.syn/wssub_match.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.syn/wssub_match.pass.cpp?rev=110955&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.syn/wssub_match.pass.cpp (added)
+++ libcxx/trunk/test/re/re.syn/wssub_match.pass.cpp Thu Aug 12 16:14:20 2010
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// typedef sub_match<wstring::const_iterator>   wssub_match;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::sub_match<std::wstring::const_iterator>, std::wssub_match>::value), "");
+}





More information about the cfe-commits mailing list