summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2010-07-07 19:14:52 +0000
committerHoward Hinnant <hhinnant@apple.com>2010-07-07 19:14:52 +0000
commit189b212662b1f35e4e77da212338e06d69db0e8a (patch)
tree462766a671a994a93983c0fe31118b7c5d163348 /libcxx/test
parenta6243587282a90104496f670d45f60a46f66c069 (diff)
downloadbcm5719-llvm-189b212662b1f35e4e77da212338e06d69db0e8a.tar.gz
bcm5719-llvm-189b212662b1f35e4e77da212338e06d69db0e8a.zip
First loop test passed. The data structure and search algorithm is still crude and in-flux. But this milestone needed to be locked in. Right now every loop is implemented in terms of a structure that will handle the most complicated {min, max} loop. Though only *-loops are tested at the moment. In a future iteration *-loops will likely be optimized a little more. The only tests are for basic posix so far, but I have prototype code running for extended posix and ecma. The prototype code lacks the complicating properties of the real <regex> requirements though.
llvm-svn: 107803
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/re/re.alg/re.alg.search/basic.pass.cpp47
1 files changed, 31 insertions, 16 deletions
diff --git a/libcxx/test/re/re.alg/re.alg.search/basic.pass.cpp b/libcxx/test/re/re.alg/re.alg.search/basic.pass.cpp
index 13ddec7373c..206ea3524d1 100644
--- a/libcxx/test/re/re.alg/re.alg.search/basic.pass.cpp
+++ b/libcxx/test/re/re.alg/re.alg.search/basic.pass.cpp
@@ -104,24 +104,39 @@ int main()
}
{
std::cmatch m;
- const char s[] = "abcdefghijk";
- assert(std::regex_search(s, m, std::regex("cd\\(\\(e\\)fg\\)hi",
- std::regex_constants::basic)));
- assert(m.size() == 3);
- assert(m.prefix().matched);
+ const char s[] = "abbc";
+ assert(std::regex_search(s, m, std::regex("ab*c", std::regex_constants::basic)));
+ 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().matched);
assert(m.suffix().first == m[0].second);
- assert(m.suffix().second == s+std::regex_traits<char>::length(s));
- assert(m.length(0) == 7);
- assert(m.position(0) == 2);
- assert(m.str(0) == "cdefghi");
- assert(m.length(1) == 3);
- assert(m.position(1) == 4);
- assert(m.str(1) == "efg");
- assert(m.length(2) == 1);
- assert(m.position(2) == 4);
- assert(m.str(2) == "e");
+ assert(m.suffix().second == s+4);
+ assert(m.length(0) == 4);
+ assert(m.position(0) == 0);
+ assert(m.str(0) == s);
}
+// {
+// std::cmatch m;
+// const char s[] = "abcdefghijk";
+// assert(std::regex_search(s, m, std::regex("cd\\(\\(e\\)fg\\)hi",
+// std::regex_constants::basic)));
+// assert(m.size() == 3);
+// 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::regex_traits<char>::length(s));
+// assert(m.length(0) == 7);
+// assert(m.position(0) == 2);
+// assert(m.str(0) == "cdefghi");
+// assert(m.length(1) == 3);
+// assert(m.position(1) == 4);
+// assert(m.str(1) == "efg");
+// assert(m.length(2) == 1);
+// assert(m.position(2) == 4);
+// assert(m.str(2) == "e");
+// }
}
OpenPOWER on IntegriCloud