table: Pit::erase accepts Entry* instead of shared_ptr
refs #3164
Change-Id: I9ff47c80865da42b09870c632707dffd78ed76b9
diff --git a/tests/daemon/table/name-tree.t.cpp b/tests/daemon/table/name-tree.t.cpp
index a839152..127056d 100644
--- a/tests/daemon/table/name-tree.t.cpp
+++ b/tests/daemon/table/name-tree.t.cpp
@@ -249,11 +249,15 @@
npe.insertPitEntry(pit2);
BOOST_CHECK_EQUAL(npe.getPitEntries().size(), 2);
- npe.erasePitEntry(pit1);
+ pit::Entry* pit1ptr = pit1.get();
+ weak_ptr<pit::Entry> pit1weak(pit1);
+ pit1.reset();
+ BOOST_CHECK_EQUAL(pit1weak.use_count(), 1); // npe is the sole owner of pit1
+ npe.erasePitEntry(pit1ptr);
BOOST_REQUIRE_EQUAL(npe.getPitEntries().size(), 1);
BOOST_CHECK_EQUAL(npe.getPitEntries().front()->getInterest(), *interest2);
- npe.erasePitEntry(pit2);
+ npe.erasePitEntry(pit2.get());
BOOST_CHECK_EQUAL(npe.hasPitEntries(), false);
BOOST_CHECK_EQUAL(npe.getPitEntries().size(), 0);
BOOST_CHECK_EQUAL(npe.hasTableEntries(), false);
diff --git a/tests/daemon/table/pit.t.cpp b/tests/daemon/table/pit.t.cpp
index 6135502..e761ef8 100644
--- a/tests/daemon/table/pit.t.cpp
+++ b/tests/daemon/table/pit.t.cpp
@@ -344,7 +344,7 @@
BOOST_CHECK_EQUAL(pit.size(), 1);
BOOST_CHECK(pit.find(*interest) != nullptr);
- pit.erase(insertResult.first);
+ pit.erase(insertResult.first.get());
BOOST_CHECK_EQUAL(pit.size(), 0);
BOOST_CHECK(pit.find(*interest) == nullptr);
@@ -362,7 +362,7 @@
shared_ptr<Interest> interest = makeInterest("/37xWVvQ2K");
shared_ptr<Entry> entry = pit.insert(*interest).first;
- pit.erase(entry);
+ pit.erase(entry.get());
BOOST_CHECK_EQUAL(nameTree.size(), nNameTreeEntriesBefore);
}
@@ -385,7 +385,7 @@
shared_ptr<pit::Entry> pitEntry = pit.find(*interest);
BOOST_REQUIRE(pitEntry != nullptr);
- pit.erase(pitEntry);
+ pit.erase(pitEntry.get());
BOOST_CHECK_EQUAL(pit.size(), 0);
BOOST_CHECK(pit.find(*interest) == nullptr);