continued regex development...

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@109512 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2010-07-27 17:24:17 +00:00
parent 17615b040d
commit ad2a7ab9a9
6 changed files with 203 additions and 145 deletions

View File

@@ -731,6 +731,22 @@ int main()
assert(std::regex_search(s, m, std::regex("[ace1-9]*",
std::regex_constants::extended)));
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[] = "01a45cef9";
assert(std::regex_search(s, m, std::regex("[ace1-9]+",
std::regex_constants::extended)));
assert(m.size() == 1);
assert(m.prefix().matched);
assert(m.prefix().first == s);
assert(m.prefix().second == m[0].first);
@@ -1471,6 +1487,22 @@ int main()
assert(std::regex_search(s, m, std::wregex(L"[ace1-9]*",
std::regex_constants::extended)));
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<wchar_t>::length(s));
assert(m.length(0) == 0);
assert(m.position(0) == 0);
assert(m.str(0) == L"");
}
{
std::wcmatch m;
const wchar_t s[] = L"01a45cef9";
assert(std::regex_search(s, m, std::wregex(L"[ace1-9]+",
std::regex_constants::extended)));
assert(m.size() == 1);
assert(m.prefix().matched);
assert(m.prefix().first == s);
assert(m.prefix().second == m[0].first);