management: Removing deprecated NFD management elements
Change-Id: I64ac0734a3197720ad7eae13b30a90b1ab797106
Refs: #1417
diff --git a/tests/util/test-regex.cpp b/tests/util/test-regex.cpp
index 86bad95..d286732 100644
--- a/tests/util/test-regex.cpp
+++ b/tests/util/test-regex.cpp
@@ -19,428 +19,428 @@
using namespace std;
namespace ndn {
-BOOST_AUTO_TEST_SUITE(TestRegex)
+BOOST_AUTO_TEST_SUITE(UtilTestRegex)
BOOST_AUTO_TEST_CASE(ComponentMatcher)
{
- ptr_lib::shared_ptr<RegexBackrefManager> backRef = ptr_lib::make_shared<RegexBackrefManager>();
- ptr_lib::shared_ptr<RegexComponentMatcher> cm = ptr_lib::make_shared<RegexComponentMatcher>("a", backRef);
+ shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
+ shared_ptr<RegexComponentMatcher> cm = make_shared<RegexComponentMatcher>("a", backRef);
bool res = cm->match(Name("/a/b/"), 0, 1);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexComponentMatcher>("a", backRef);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexComponentMatcher>("a", backRef);
res = cm->match(Name("/a/b/"), 1, 1);
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexComponentMatcher>("(c+)\\.(cd)", backRef);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexComponentMatcher>("(c+)\\.(cd)", backRef);
res = cm->match(Name("/ccc.cd/b/"), 0, 1);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("ccc.cd"));
- BOOST_CHECK_EQUAL(backRef->getBackRef (0)->getMatchResult ()[0].toEscapedString(), string("ccc"));
- BOOST_CHECK_EQUAL(backRef->getBackRef (1)->getMatchResult ()[0].toEscapedString(), string("cd"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("ccc.cd"));
+ BOOST_CHECK_EQUAL(backRef->getBackRef(0)->getMatchResult()[0].toEscapedString(), string("ccc"));
+ BOOST_CHECK_EQUAL(backRef->getBackRef(1)->getMatchResult()[0].toEscapedString(), string("cd"));
}
-BOOST_AUTO_TEST_CASE (ComponentSetMatcher)
+BOOST_AUTO_TEST_CASE(ComponentSetMatcher)
{
- ptr_lib::shared_ptr<RegexBackrefManager> backRef = ptr_lib::make_shared<RegexBackrefManager>();
- ptr_lib::shared_ptr<RegexComponentSetMatcher> cm = ptr_lib::make_shared<RegexComponentSetMatcher>("<a>", backRef);
+ shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
+ shared_ptr<RegexComponentSetMatcher> cm = make_shared<RegexComponentSetMatcher>("<a>", backRef);
bool res = cm->match(Name("/a/b/"), 0, 1);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
res = cm->match(Name("/a/b/"), 1, 1);
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
res = cm->match(Name("/a/b/"), 0, 2);
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexComponentSetMatcher>("[<a><b><c>]", backRef);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexComponentSetMatcher>("[<a><b><c>]", backRef);
res = cm->match(Name("/a/b/d"), 1, 1);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("b"));
res = cm->match(Name("/a/b/d"), 2, 1);
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexComponentSetMatcher>("[^<a><b><c>]", backRef);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexComponentSetMatcher>("[^<a><b><c>]", backRef);
res = cm->match(Name("/b/d"), 1, 1);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("d"));
}
-BOOST_AUTO_TEST_CASE (RepeatMatcher)
+BOOST_AUTO_TEST_CASE(RepeatMatcher)
{
- ptr_lib::shared_ptr<RegexBackrefManager> backRef = ptr_lib::make_shared<RegexBackrefManager>();
- ptr_lib::shared_ptr<RegexRepeatMatcher> cm = ptr_lib::make_shared<RegexRepeatMatcher>("[<a><b>]*", backRef, 8);
+ shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
+ shared_ptr<RegexRepeatMatcher> cm = make_shared<RegexRepeatMatcher>("[<a><b>]*", backRef, 8);
bool res = cm->match(Name("/a/b/c"), 0, 0);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexRepeatMatcher>("[<a><b>]+", backRef, 8);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexRepeatMatcher>("[<a><b>]+", backRef, 8);
res = cm->match(Name("/a/b/c"), 0, 0);
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
res = cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexRepeatMatcher>("<.*>*", backRef, 4);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexRepeatMatcher>("<.*>*", backRef, 4);
res = cm->match(Name("/a/b/c/d/e/f/"), 0, 6);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 6);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[3].toEscapedString(), string("d"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[4].toEscapedString(), string("e"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[5].toEscapedString(), string("f"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 6);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[4].toEscapedString(), string("e"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[5].toEscapedString(), string("f"));
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexRepeatMatcher>("<>*", backRef, 2);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexRepeatMatcher>("<>*", backRef, 2);
res = cm->match(Name("/a/b/c/d/e/f/"), 0, 6);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 6);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[3].toEscapedString(), string("d"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[4].toEscapedString(), string("e"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[5].toEscapedString(), string("f"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 6);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[4].toEscapedString(), string("e"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[5].toEscapedString(), string("f"));
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexRepeatMatcher>("<a>?", backRef, 3);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexRepeatMatcher>("<a>?", backRef, 3);
res = cm->match(Name("/a/b/c"), 0, 0);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
- cm = ptr_lib::make_shared<RegexRepeatMatcher>("<a>?", backRef, 3);
+ cm = make_shared<RegexRepeatMatcher>("<a>?", backRef, 3);
res = cm->match(Name("/a/b/c"), 0, 1);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- cm = ptr_lib::make_shared<RegexRepeatMatcher>("<a>?", backRef, 3);
+ cm = make_shared<RegexRepeatMatcher>("<a>?", backRef, 3);
res = cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexRepeatMatcher>("[<a><b>]{3}", backRef, 8);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexRepeatMatcher>("[<a><b>]{3}", backRef, 8);
res = cm->match(Name("/a/b/a/d/"), 0, 2);
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
res = cm->match(Name("/a/b/a/d/"), 0, 3);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 3);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[2].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 3);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("a"));
res = cm->match(Name("/a/b/a/d/"), 0, 4);
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexRepeatMatcher>("[<a><b>]{2,3}", backRef, 8);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexRepeatMatcher>("[<a><b>]{2,3}", backRef, 8);
res = cm->match(Name("/a/b/a/d/e/"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
res = cm->match(Name("/a/b/a/d/e/"), 0, 3);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 3);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[2].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 3);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("a"));
res = cm->match(Name("/a/b/a/b/e/"), 0, 4);
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
res = cm->match(Name("/a/b/a/d/e/"), 0, 1);
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexRepeatMatcher>("[<a><b>]{2,}", backRef, 8);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexRepeatMatcher>("[<a><b>]{2,}", backRef, 8);
res = cm->match(Name("/a/b/a/d/e/"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
res = cm->match(Name("/a/b/a/b/e/"), 0, 4);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 4);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[2].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[3].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("b"));
res = cm->match(Name("/a/b/a/d/e/"), 0, 1);
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexRepeatMatcher>("[<a><b>]{,2}", backRef, 8);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexRepeatMatcher>("[<a><b>]{,2}", backRef, 8);
res = cm->match(Name("/a/b/a/b/e/"), 0, 3);
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
res = cm->match(Name("/a/b/a/b/e/"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
res = cm->match(Name("/a/b/a/d/e/"), 0, 1);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
res = cm->match(Name("/a/b/a/d/e/"), 0, 0);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
}
-BOOST_AUTO_TEST_CASE (BackRefMatcher)
+BOOST_AUTO_TEST_CASE(BackRefMatcher)
{
- ptr_lib::shared_ptr<RegexBackrefManager> backRef = ptr_lib::make_shared<RegexBackrefManager>();
- ptr_lib::shared_ptr<RegexBackrefMatcher> cm = ptr_lib::make_shared<RegexBackrefMatcher>("(<a><b>)", backRef);
+ shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
+ shared_ptr<RegexBackrefMatcher> cm = make_shared<RegexBackrefMatcher>("(<a><b>)", backRef);
backRef->pushRef(boost::static_pointer_cast<RegexMatcher>(cm));
cm->lateCompile();
bool res = cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
BOOST_CHECK_EQUAL(backRef->size(), 1);
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexBackrefMatcher>("(<a>(<b>))", backRef);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexBackrefMatcher>("(<a>(<b>))", backRef);
backRef->pushRef(cm);
cm->lateCompile();
res = cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
BOOST_CHECK_EQUAL(backRef->size(), 2);
- BOOST_CHECK_EQUAL(backRef->getBackRef (0)->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(backRef->getBackRef (0)->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(backRef->getBackRef (1)->getMatchResult ()[0].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(backRef->getBackRef(0)->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(backRef->getBackRef(0)->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(backRef->getBackRef(1)->getMatchResult()[0].toEscapedString(), string("b"));
}
-BOOST_AUTO_TEST_CASE (BackRefMatcherAdvanced)
+BOOST_AUTO_TEST_CASE(BackRefMatcherAdvanced)
{
- ptr_lib::shared_ptr<RegexBackrefManager> backRef = ptr_lib::make_shared<RegexBackrefManager>();
- ptr_lib::shared_ptr<RegexRepeatMatcher> cm = ptr_lib::make_shared<RegexRepeatMatcher>("([<a><b>])+", backRef, 10);
+ shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
+ shared_ptr<RegexRepeatMatcher> cm = make_shared<RegexRepeatMatcher>("([<a><b>])+", backRef, 10);
bool res = cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
BOOST_CHECK_EQUAL(backRef->size(), 1);
- BOOST_CHECK_EQUAL(backRef->getBackRef (0)->getMatchResult ()[0].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(backRef->getBackRef(0)->getMatchResult()[0].toEscapedString(), string("b"));
}
-BOOST_AUTO_TEST_CASE (BackRefMatcherAdvanced2)
+BOOST_AUTO_TEST_CASE(BackRefMatcherAdvanced2)
{
- ptr_lib::shared_ptr<RegexBackrefManager> backRef = ptr_lib::make_shared<RegexBackrefManager>();
- ptr_lib::shared_ptr<RegexPatternListMatcher> cm = ptr_lib::make_shared<RegexPatternListMatcher>("(<a>(<b>))<c>", backRef);
+ shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
+ shared_ptr<RegexPatternListMatcher> cm = make_shared<RegexPatternListMatcher>("(<a>(<b>))<c>", backRef);
bool res = cm->match(Name("/a/b/c"), 0, 3);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 3);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[2].toEscapedString(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 3);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
BOOST_CHECK_EQUAL(backRef->size(), 2);
- BOOST_CHECK_EQUAL(backRef->getBackRef (0)->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(backRef->getBackRef (0)->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(backRef->getBackRef (1)->getMatchResult ()[0].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(backRef->getBackRef(0)->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(backRef->getBackRef(0)->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(backRef->getBackRef(1)->getMatchResult()[0].toEscapedString(), string("b"));
}
-BOOST_AUTO_TEST_CASE (PatternListMatcher)
+BOOST_AUTO_TEST_CASE(PatternListMatcher)
{
- ptr_lib::shared_ptr<RegexBackrefManager> backRef = ptr_lib::make_shared<RegexBackrefManager>();
- ptr_lib::shared_ptr<RegexPatternListMatcher> cm = ptr_lib::make_shared<RegexPatternListMatcher>("<a>[<a><b>]", backRef);
+ shared_ptr<RegexBackrefManager> backRef = make_shared<RegexBackrefManager>();
+ shared_ptr<RegexPatternListMatcher> cm = make_shared<RegexPatternListMatcher>("<a>[<a><b>]", backRef);
bool res = cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 2);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 2);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexPatternListMatcher>("<>*<a>", backRef);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexPatternListMatcher>("<>*<a>", backRef);
res = cm->match(Name("/a/b/c"), 0, 1);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 1);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 1);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexPatternListMatcher>("<>*<a>", backRef);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexPatternListMatcher>("<>*<a>", backRef);
res = cm->match(Name("/a/b/c"), 0, 2);
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
- backRef = ptr_lib::make_shared<RegexBackrefManager>();
- cm = ptr_lib::make_shared<RegexPatternListMatcher>("<>*<a><>*", backRef);
+ backRef = make_shared<RegexBackrefManager>();
+ cm = make_shared<RegexPatternListMatcher>("<>*<a><>*", backRef);
res = cm->match(Name("/a/b/c"), 0, 3);
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 3);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[2].toEscapedString(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 3);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
}
-BOOST_AUTO_TEST_CASE (TopMatcher)
+BOOST_AUTO_TEST_CASE(TopMatcher)
{
- ptr_lib::shared_ptr<RegexTopMatcher> cm = ptr_lib::make_shared<RegexTopMatcher>("^<a><b><c>");
+ shared_ptr<RegexTopMatcher> cm = make_shared<RegexTopMatcher>("^<a><b><c>");
bool res = cm->match(Name("/a/b/c/d"));
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 4);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[3].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
- cm = ptr_lib::make_shared<RegexTopMatcher>("<b><c><d>$");
+ cm = make_shared<RegexTopMatcher>("<b><c><d>$");
res = cm->match(Name("/a/b/c/d"));
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 4);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[3].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
- cm = ptr_lib::make_shared<RegexTopMatcher>("^<a><b><c><d>$");
+ cm = make_shared<RegexTopMatcher>("^<a><b><c><d>$");
res = cm->match(Name("/a/b/c/d"));
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 4);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[3].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
res = cm->match(Name("/a/b/c/d/e"));
BOOST_CHECK_EQUAL(res, false);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 0);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 0);
- cm = ptr_lib::make_shared<RegexTopMatcher>("<a><b><c><d>");
+ cm = make_shared<RegexTopMatcher>("<a><b><c><d>");
res = cm->match(Name("/a/b/c/d"));
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 4);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[3].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
- cm = ptr_lib::make_shared<RegexTopMatcher>("<b><c>");
+ cm = make_shared<RegexTopMatcher>("<b><c>");
res = cm->match(Name("/a/b/c/d"));
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 4);
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[0].toEscapedString(), string("a"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[1].toEscapedString(), string("b"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[2].toEscapedString(), string("c"));
- BOOST_CHECK_EQUAL(cm->getMatchResult ()[3].toEscapedString(), string("d"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[0].toEscapedString(), string("a"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[1].toEscapedString(), string("b"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[2].toEscapedString(), string("c"));
+ BOOST_CHECK_EQUAL(cm->getMatchResult()[3].toEscapedString(), string("d"));
}
-BOOST_AUTO_TEST_CASE (TopMatcherAdvanced)
+BOOST_AUTO_TEST_CASE(TopMatcherAdvanced)
{
- ptr_lib::shared_ptr<Regex> cm = ptr_lib::make_shared<Regex>("^(<.*>*)<.*>");
+ shared_ptr<Regex> cm = make_shared<Regex>("^(<.*>*)<.*>");
bool res = cm->match(Name("/n/a/b/c"));
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 4);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
BOOST_CHECK_EQUAL(cm->expand("\\1"), Name("/n/a/b/"));
- cm = ptr_lib::make_shared<Regex>("^(<.*>*)<.*><c>(<.*>)<.*>");
+ cm = make_shared<Regex>("^(<.*>*)<.*><c>(<.*>)<.*>");
res = cm->match(Name("/n/a/b/c/d/e/"));
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 6);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 6);
BOOST_CHECK_EQUAL(cm->expand("\\1\\2"), Name("/n/a/d/"));
- cm = ptr_lib::make_shared<Regex>("(<.*>*)<.*>$");
+ cm = make_shared<Regex>("(<.*>*)<.*>$");
res = cm->match(Name("/n/a/b/c/"));
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 4);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
BOOST_CHECK_EQUAL(cm->expand("\\1"), Name("/n/a/b/"));
- cm = ptr_lib::make_shared<Regex>("<.*>(<.*>*)<.*>$");
+ cm = make_shared<Regex>("<.*>(<.*>*)<.*>$");
res = cm->match(Name("/n/a/b/c/"));
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 4);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
BOOST_CHECK_EQUAL(cm->expand("\\1"), Name("/a/b/"));
- cm = ptr_lib::make_shared<Regex>("<a>(<>*)<>$");
+ cm = make_shared<Regex>("<a>(<>*)<>$");
res = cm->match(Name("/n/a/b/c/"));
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 4);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 4);
BOOST_CHECK_EQUAL(cm->expand("\\1"), Name("/b/"));
- cm = ptr_lib::make_shared<Regex>("^<ndn><(.*)\\.(.*)><DNS>(<>*)<>");
+ cm = make_shared<Regex>("^<ndn><(.*)\\.(.*)><DNS>(<>*)<>");
res = cm->match(Name("/ndn/ucla.edu/DNS/yingdi/mac/ksk-1/"));
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 6);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 6);
BOOST_CHECK_EQUAL(cm->expand("<ndn>\\2\\1\\3"), Name("/ndn/edu/ucla/yingdi/mac/"));
- cm = ptr_lib::make_shared<Regex>("^<ndn><(.*)\\.(.*)><DNS>(<>*)<>", "<ndn>\\2\\1\\3");
+ cm = make_shared<Regex>("^<ndn><(.*)\\.(.*)><DNS>(<>*)<>", "<ndn>\\2\\1\\3");
res = cm->match(Name("/ndn/ucla.edu/DNS/yingdi/mac/ksk-1/"));
BOOST_CHECK_EQUAL(res, true);
- BOOST_CHECK_EQUAL(cm->getMatchResult ().size(), 6);
+ BOOST_CHECK_EQUAL(cm->getMatchResult().size(), 6);
BOOST_CHECK_EQUAL(cm->expand(), Name("/ndn/edu/ucla/yingdi/mac/"));
}