Everything under [re.regex]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111024 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
33
test/re/re.regex/re.regex.assign/assign.il.pass.cpp
Normal file
33
test/re/re.regex/re.regex.assign/assign.il.pass.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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&
|
||||
// assign(initializer_list<charT> il,
|
||||
// flag_type f = regex_constants::ECMAScript);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
std::regex r2;
|
||||
r2.assign({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'});
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
|
||||
r2.assign({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex::extended);
|
||||
assert(r2.flags() == std::regex::extended);
|
||||
assert(r2.mark_count() == 2);
|
||||
#endif
|
||||
}
|
26
test/re/re.regex/re.regex.assign/assign.pass.cpp
Normal file
26
test/re/re.regex/re.regex.assign/assign.pass.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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& assign(const basic_regex& that);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::regex r1("(a([bc]))");
|
||||
std::regex r2;
|
||||
r2.assign(r1);
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 InputIterator>
|
||||
// basic_regex&
|
||||
// assign(InputIterator first, InputIterator last,
|
||||
// flag_type f = regex_constants::ECMAScript);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../iterators.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef input_iterator<std::string::const_iterator> I;
|
||||
typedef forward_iterator<std::string::const_iterator> F;
|
||||
std::string s4("(a([bc]))");
|
||||
std::regex r2;
|
||||
|
||||
r2.assign(I(s4.begin()), I(s4.end()));
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
|
||||
r2.assign(I(s4.begin()), I(s4.end()), std::regex::extended);
|
||||
assert(r2.flags() == std::regex::extended);
|
||||
assert(r2.mark_count() == 2);
|
||||
|
||||
r2.assign(F(s4.begin()), F(s4.end()));
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
|
||||
r2.assign(F(s4.begin()), F(s4.end()), std::regex::extended);
|
||||
assert(r2.flags() == std::regex::extended);
|
||||
assert(r2.mark_count() == 2);
|
||||
}
|
29
test/re/re.regex/re.regex.assign/assign_ptr_flag.pass.cpp
Normal file
29
test/re/re.regex/re.regex.assign/assign_ptr_flag.pass.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::regex r2;
|
||||
r2.assign("(a([bc]))");
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
|
||||
r2.assign("(a([bc]))", std::regex::extended);
|
||||
assert(r2.flags() == std::regex::extended);
|
||||
assert(r2.mark_count() == 2);
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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& assign(const charT* ptr, size_t len, flag_type f);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::regex r2;
|
||||
r2.assign("(a([bc]))", 9, std::regex::extended);
|
||||
assert(r2.flags() == std::regex::extended);
|
||||
assert(r2.mark_count() == 2);
|
||||
}
|
31
test/re/re.regex/re.regex.assign/assign_string_flag.pass.cpp
Normal file
31
test/re/re.regex/re.regex.assign/assign_string_flag.pass.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 string_traits, class A>
|
||||
// basic_regex& assign(const basic_string<charT, string_traits, A>& s,
|
||||
// flag_type f = regex_constants::ECMAScript);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::regex r2;
|
||||
r2.assign(std::string("(a([bc]))"));
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
|
||||
r2.assign(std::string("(a([bc]))"), std::regex::extended);
|
||||
assert(r2.flags() == std::regex::extended);
|
||||
assert(r2.mark_count() == 2);
|
||||
}
|
26
test/re/re.regex/re.regex.assign/copy.pass.cpp
Normal file
26
test/re/re.regex/re.regex.assign/copy.pass.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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& operator=(const basic_regex& e);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::regex r1("(a([bc]))");
|
||||
std::regex r2;
|
||||
r2 = r1;
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
}
|
27
test/re/re.regex/re.regex.assign/il.pass.cpp
Normal file
27
test/re/re.regex/re.regex.assign/il.pass.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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& operator=(initializer_list<charT> il);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _LIBCPP_MOVE
|
||||
std::regex r2;
|
||||
r2 = {'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'};
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
#endif
|
||||
}
|
25
test/re/re.regex/re.regex.assign/ptr.pass.cpp
Normal file
25
test/re/re.regex/re.regex.assign/ptr.pass.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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& operator=(const charT* ptr);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::regex r2;
|
||||
r2 = "(a([bc]))";
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
}
|
26
test/re/re.regex/re.regex.assign/string.pass.cpp
Normal file
26
test/re/re.regex/re.regex.assign/string.pass.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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& operator=(const basic_string<charT, ST, SA>& p);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::regex r2;
|
||||
r2 = std::string("(a([bc]))");
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
}
|
25
test/re/re.regex/re.regex.construct/copy.pass.cpp
Normal file
25
test/re/re.regex/re.regex.construct/copy.pass.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 basic_regex& e);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::regex r1("(a([bc]))");
|
||||
std::regex r2 = r1;
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
}
|
@@ -13,8 +13,6 @@
|
||||
|
||||
// basic_regex(const charT* p);
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
|
@@ -13,8 +13,6 @@
|
||||
|
||||
// basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
|
@@ -15,8 +15,6 @@
|
||||
// basic_regex(const basic_string<charT, ST, SA>& s,
|
||||
// flag_type f = regex_constants::ECMAScript);
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
|
29
test/re/re.regex/re.regex.locale/imbue.pass.cpp
Normal file
29
test/re/re.regex/re.regex.locale/imbue.pass.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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;
|
||||
|
||||
// locale_type imbue(locale_type loc);
|
||||
|
||||
#include <regex>
|
||||
#include <locale>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::regex r;
|
||||
std::locale loc = r.imbue(std::locale("en_US"));
|
||||
assert(loc.name() == "C");
|
||||
assert(r.getloc().name() == "en_US");
|
||||
loc = r.imbue(std::locale("C"));
|
||||
assert(loc.name() == "en_US");
|
||||
assert(r.getloc().name() == "C");
|
||||
}
|
12
test/re/re.regex/re.regex.nonmemb/nothing_to_do.pass.cpp
Normal file
12
test/re/re.regex/re.regex.nonmemb/nothing_to_do.pass.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 charT, class traits>
|
||||
// void swap(basic_regex<charT, traits>& lhs, basic_regex<charT, traits>& rhs);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::regex r1("(a([bc]))");
|
||||
std::regex r2;
|
||||
swap(r2, r1);
|
||||
assert(r1.flags() == std::regex::ECMAScript);
|
||||
assert(r1.mark_count() == 0);
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
28
test/re/re.regex/re.regex.swap/swap.pass.cpp
Normal file
28
test/re/re.regex/re.regex.swap/swap.pass.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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;
|
||||
|
||||
// void swap(basic_regex& e);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::regex r1("(a([bc]))");
|
||||
std::regex r2;
|
||||
r2.swap(r1);
|
||||
assert(r1.flags() == std::regex::ECMAScript);
|
||||
assert(r1.mark_count() == 0);
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
}
|
Reference in New Issue
Block a user