Move test into test/std subdirectory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
1573
test/std/re/re.alg/re.alg.search/awk.pass.cpp
Normal file
1573
test/std/re/re.alg/re.alg.search/awk.pass.cpp
Normal file
File diff suppressed because it is too large
Load Diff
63
test/std/re/re.alg/re.alg.search/backup.pass.cpp
Normal file
63
test/std/re/re.alg/re.alg.search/backup.pass.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator, class Allocator, class charT, class traits>
|
||||
// bool
|
||||
// regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||||
// match_results<BidirectionalIterator, Allocator>& m,
|
||||
// const basic_regex<charT, traits>& e,
|
||||
// regex_constants::match_flag_type flags = regex_constants::match_default);
|
||||
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
// This regex_iterator uses regex_search(__wrap_iter<_Iter> __first, ...)
|
||||
// Test for http://llvm.org/bugs/show_bug.cgi?id=16240 fixed in r185273.
|
||||
{
|
||||
std::string s("aaaa a");
|
||||
std::regex re("\\ba");
|
||||
std::sregex_iterator it(s.begin(), s.end(), re);
|
||||
std::sregex_iterator end = std::sregex_iterator();
|
||||
|
||||
assert(it->position(0) == 0);
|
||||
assert(it->length(0) == 1);
|
||||
|
||||
++it;
|
||||
assert(it->position(0) == 5);
|
||||
assert(it->length(0) == 1);
|
||||
|
||||
++it;
|
||||
assert(it == end);
|
||||
}
|
||||
|
||||
// This regex_iterator uses regex_search(_BidirectionalIterator __first, ...)
|
||||
{
|
||||
std::string s("aaaa a");
|
||||
std::list<char> l(s.begin(), s.end());
|
||||
std::regex re("\\ba");
|
||||
std::regex_iterator<std::list<char>::iterator> it(l.begin(), l.end(), re);
|
||||
std::regex_iterator<std::list<char>::iterator> end = std::regex_iterator<std::list<char>::iterator>();
|
||||
|
||||
assert(it->position(0) == 0);
|
||||
assert(it->length(0) == 1);
|
||||
|
||||
++it;
|
||||
assert(it->position(0) == 5);
|
||||
assert(it->length(0) == 1);
|
||||
|
||||
++it;
|
||||
assert(it == end);
|
||||
}
|
||||
}
|
38
test/std/re/re.alg/re.alg.search/basic.fail.cpp
Normal file
38
test/std/re/re.alg/re.alg.search/basic.fail.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class ST, class SA, class Allocator, class charT, class traits>
|
||||
// bool regex_search(const basic_string<charT, ST, SA>&&,
|
||||
// match_results<
|
||||
// typename basic_string<charT, ST, SA>::const_iterator,
|
||||
// Allocator>&,
|
||||
// const basic_regex<charT, traits>&,
|
||||
// regex_constants::match_flag_type =
|
||||
// regex_constants::match_default) = delete;
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if _LIBCPP_STD_VER <= 11
|
||||
#error
|
||||
#else
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::smatch m;
|
||||
std::regex re{"*"};
|
||||
std::regex_search(std::string("abcde"), m, re);
|
||||
}
|
||||
}
|
||||
#endif
|
1546
test/std/re/re.alg/re.alg.search/basic.pass.cpp
Normal file
1546
test/std/re/re.alg/re.alg.search/basic.pass.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1588
test/std/re/re.alg/re.alg.search/ecma.pass.cpp
Normal file
1588
test/std/re/re.alg/re.alg.search/ecma.pass.cpp
Normal file
File diff suppressed because it is too large
Load Diff
90
test/std/re/re.alg/re.alg.search/egrep.pass.cpp
Normal file
90
test/std/re/re.alg/re.alg.search/egrep.pass.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator, class Allocator, class charT, class traits>
|
||||
// bool
|
||||
// regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||||
// match_results<BidirectionalIterator, Allocator>& m,
|
||||
// const basic_regex<charT, traits>& e,
|
||||
// regex_constants::match_flag_type flags = regex_constants::match_default);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_iterators.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::cmatch m;
|
||||
const char s[] = "tournament";
|
||||
assert(std::regex_search(s, m, std::regex("tour\nto\ntournament",
|
||||
std::regex_constants::egrep)));
|
||||
assert(m.size() == 1);
|
||||
assert(!m.prefix().matched);
|
||||
assert(m.prefix().first == s);
|
||||
assert(m.prefix().second == m[0].first);
|
||||
assert(!m.suffix().matched);
|
||||
assert(m.suffix().first == m[0].second);
|
||||
assert(m.suffix().second == s + std::char_traits<char>::length(s));
|
||||
assert(m.length(0) == 10);
|
||||
assert(m.position(0) == 0);
|
||||
assert(m.str(0) == "tournament");
|
||||
}
|
||||
{
|
||||
std::cmatch m;
|
||||
const char s[] = "ment";
|
||||
assert(std::regex_search(s, m, std::regex("tour\n\ntournament",
|
||||
std::regex_constants::egrep)));
|
||||
assert(m.size() == 1);
|
||||
assert(!m.prefix().matched);
|
||||
assert(m.prefix().first == s);
|
||||
assert(m.prefix().second == m[0].first);
|
||||
assert(m.suffix().matched);
|
||||
assert(m.suffix().first == m[0].second);
|
||||
assert(m.suffix().second == s + std::char_traits<char>::length(s));
|
||||
assert(m.length(0) == 0);
|
||||
assert(m.position(0) == 0);
|
||||
assert(m.str(0) == "");
|
||||
}
|
||||
{
|
||||
std::cmatch m;
|
||||
const char s[] = "tournament";
|
||||
assert(std::regex_search(s, m, std::regex("(tour|to|tournament)+\ntourna",
|
||||
std::regex_constants::egrep)));
|
||||
assert(m.size() == 2);
|
||||
assert(!m.prefix().matched);
|
||||
assert(m.prefix().first == s);
|
||||
assert(m.prefix().second == m[0].first);
|
||||
assert(!m.suffix().matched);
|
||||
assert(m.suffix().first == m[0].second);
|
||||
assert(m.suffix().second == s + std::char_traits<char>::length(s));
|
||||
assert(m.length(0) == 10);
|
||||
assert(m.position(0) == 0);
|
||||
assert(m.str(0) == "tournament");
|
||||
}
|
||||
{
|
||||
std::cmatch m;
|
||||
const char s[] = "tourna";
|
||||
assert(std::regex_search(s, m, std::regex("(tour|to|tournament)+\ntourna",
|
||||
std::regex_constants::egrep)));
|
||||
assert(m.size() == 2);
|
||||
assert(!m.prefix().matched);
|
||||
assert(m.prefix().first == s);
|
||||
assert(m.prefix().second == m[0].first);
|
||||
assert(!m.suffix().matched);
|
||||
assert(m.suffix().first == m[0].second);
|
||||
assert(m.suffix().second == s + std::char_traits<char>::length(s));
|
||||
assert(m.length(0) == 6);
|
||||
assert(m.position(0) == 0);
|
||||
assert(m.str(0) == "tourna");
|
||||
}
|
||||
}
|
1542
test/std/re/re.alg/re.alg.search/extended.pass.cpp
Normal file
1542
test/std/re/re.alg/re.alg.search/extended.pass.cpp
Normal file
File diff suppressed because it is too large
Load Diff
58
test/std/re/re.alg/re.alg.search/grep.pass.cpp
Normal file
58
test/std/re/re.alg/re.alg.search/grep.pass.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator, class Allocator, class charT, class traits>
|
||||
// bool
|
||||
// regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||||
// match_results<BidirectionalIterator, Allocator>& m,
|
||||
// const basic_regex<charT, traits>& e,
|
||||
// regex_constants::match_flag_type flags = regex_constants::match_default);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_iterators.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::cmatch m;
|
||||
const char s[] = "tournament";
|
||||
assert(std::regex_search(s, m, std::regex("tour\nto\ntournament",
|
||||
std::regex_constants::grep)));
|
||||
assert(m.size() == 1);
|
||||
assert(!m.prefix().matched);
|
||||
assert(m.prefix().first == s);
|
||||
assert(m.prefix().second == m[0].first);
|
||||
assert(!m.suffix().matched);
|
||||
assert(m.suffix().first == m[0].second);
|
||||
assert(m.suffix().second == s + std::char_traits<char>::length(s));
|
||||
assert(m.length(0) == 10);
|
||||
assert(m.position(0) == 0);
|
||||
assert(m.str(0) == "tournament");
|
||||
}
|
||||
{
|
||||
std::cmatch m;
|
||||
const char s[] = "ment";
|
||||
assert(std::regex_search(s, m, std::regex("tour\n\ntournament",
|
||||
std::regex_constants::grep)));
|
||||
assert(m.size() == 1);
|
||||
assert(!m.prefix().matched);
|
||||
assert(m.prefix().first == s);
|
||||
assert(m.prefix().second == m[0].first);
|
||||
assert(m.suffix().matched);
|
||||
assert(m.suffix().first == m[0].second);
|
||||
assert(m.suffix().second == s + std::char_traits<char>::length(s));
|
||||
assert(m.length(0) == 0);
|
||||
assert(m.position(0) == 0);
|
||||
assert(m.str(0) == "");
|
||||
}
|
||||
}
|
28
test/std/re/re.alg/re.alg.search/lookahead.pass.cpp
Normal file
28
test/std/re/re.alg/re.alg.search/lookahead.pass.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator, class Allocator, class charT, class traits>
|
||||
// bool
|
||||
// regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||||
// match_results<BidirectionalIterator, Allocator>& m,
|
||||
// const basic_regex<charT, traits>& e,
|
||||
// regex_constants::match_flag_type flags = regex_constants::match_default);
|
||||
|
||||
// http://llvm.org/bugs/show_bug.cgi?id=11118
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
assert(!std::regex_search("ab", std::regex("(?=^)b")));
|
||||
assert(!std::regex_search("ab", std::regex("a(?=^)b")));
|
||||
}
|
38
test/std/re/re.alg/re.alg.search/no_update_pos.pass.cpp
Normal file
38
test/std/re/re.alg/re.alg.search/no_update_pos.pass.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <regex>
|
||||
|
||||
// template <class BidirectionalIterator, class Allocator, class charT, class traits>
|
||||
// bool
|
||||
// regex_search(BidirectionalIterator first, BidirectionalIterator last,
|
||||
// match_results<BidirectionalIterator, Allocator>& m,
|
||||
// const basic_regex<charT, traits>& e,
|
||||
// regex_constants::match_flag_type flags = regex_constants::match_default);
|
||||
|
||||
#include <regex>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Iterating over /^a/ should yield one instance at the beginning
|
||||
// of the text.
|
||||
|
||||
const char *text = "aaa\naa";
|
||||
std::regex re("^a");
|
||||
std::cregex_iterator it(text, text+6, re);
|
||||
std::cregex_iterator end = std::cregex_iterator();
|
||||
|
||||
assert(it->str() == "a");
|
||||
assert(it->position(0) == 0);
|
||||
assert(it->length(0) == 1);
|
||||
|
||||
++it;
|
||||
assert(it == end);
|
||||
}
|
Reference in New Issue
Block a user