table: pit::FaceRecord stores Face& instead of shared_ptr
refs #3164
Change-Id: Ib23ab2341a37213fee791f2070f13b76da851d53
diff --git a/tests/daemon/table/cleanup.t.cpp b/tests/daemon/table/cleanup.t.cpp
index 0df019c..20638ab 100644
--- a/tests/daemon/table/cleanup.t.cpp
+++ b/tests/daemon/table/cleanup.t.cpp
@@ -55,10 +55,10 @@
shared_ptr<Interest> interest = makeInterest(name);
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
if ((i & 0x01) != 0) {
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
}
if ((i & 0x02) != 0) {
- pitEntry->insertOrUpdateOutRecord(face1, *interest);
+ pitEntry->insertOrUpdateOutRecord(*face1, *interest);
}
}
BOOST_CHECK_EQUAL(fib.size(), 300);
@@ -144,22 +144,22 @@
shared_ptr<Interest> interestA = makeInterest("/A");
shared_ptr<pit::Entry> entryA = pit.insert(*interestA).first;
- entryA->insertOrUpdateInRecord(face1, *interestA);
- entryA->insertOrUpdateInRecord(face2, *interestA);
- entryA->insertOrUpdateOutRecord(face1, *interestA);
- entryA->insertOrUpdateOutRecord(face2, *interestA);
+ entryA->insertOrUpdateInRecord(*face1, *interestA);
+ entryA->insertOrUpdateInRecord(*face2, *interestA);
+ entryA->insertOrUpdateOutRecord(*face1, *interestA);
+ entryA->insertOrUpdateOutRecord(*face2, *interestA);
// {'/A':[1,2]}
shared_ptr<Interest> interestB = makeInterest("/B");
shared_ptr<pit::Entry> entryB = pit.insert(*interestB).first;
- entryB->insertOrUpdateInRecord(face1, *interestB);
- entryB->insertOrUpdateOutRecord(face1, *interestB);
+ entryB->insertOrUpdateInRecord(*face1, *interestB);
+ entryB->insertOrUpdateOutRecord(*face1, *interestB);
// {'/A':[1,2], '/B':[1]}
shared_ptr<Interest> interestC = makeInterest("/C");
shared_ptr<pit::Entry> entryC = pit.insert(*interestC).first;
- entryC->insertOrUpdateInRecord(face2, *interestC);
- entryC->insertOrUpdateOutRecord(face2, *interestC);
+ entryC->insertOrUpdateInRecord(*face2, *interestC);
+ entryC->insertOrUpdateOutRecord(*face2, *interestC);
// {'/A':[1,2], '/B':[1], '/C':[2]}
BOOST_CHECK_EQUAL(pit.size(), 3);
@@ -172,9 +172,9 @@
shared_ptr<pit::Entry> foundA = pit.find(*interestA);
BOOST_REQUIRE(foundA != nullptr);
BOOST_REQUIRE_EQUAL(foundA->getInRecords().size(), 1);
- BOOST_CHECK_EQUAL(foundA->getInRecords().front().getFace(), face2);
+ BOOST_CHECK_EQUAL(&foundA->getInRecords().front().getFace(), face2.get());
BOOST_REQUIRE_EQUAL(foundA->getOutRecords().size(), 1);
- BOOST_CHECK_EQUAL(foundA->getOutRecords().front().getFace(), face2);
+ BOOST_CHECK_EQUAL(&foundA->getOutRecords().front().getFace(), face2.get());
}
BOOST_AUTO_TEST_SUITE_END() // FaceRemovalCleanup
diff --git a/tests/daemon/table/pit.t.cpp b/tests/daemon/table/pit.t.cpp
index 0418f7e..6135502 100644
--- a/tests/daemon/table/pit.t.cpp
+++ b/tests/daemon/table/pit.t.cpp
@@ -70,12 +70,12 @@
// insert in-record
time::steady_clock::TimePoint before1 = time::steady_clock::now();
- InRecordCollection::iterator in1 = entry.insertOrUpdateInRecord(face1, *interest1);
+ InRecordCollection::iterator in1 = entry.insertOrUpdateInRecord(*face1, *interest1);
time::steady_clock::TimePoint after1 = time::steady_clock::now();
const InRecordCollection& inRecords2 = entry.getInRecords();
BOOST_CHECK_EQUAL(inRecords2.size(), 1);
BOOST_CHECK(in1 == inRecords2.begin());
- BOOST_CHECK_EQUAL(in1->getFace(), face1);
+ BOOST_CHECK_EQUAL(&in1->getFace(), face1.get());
BOOST_CHECK_EQUAL(in1->getLastNonce(), interest1->getNonce());
BOOST_CHECK_GE(in1->getLastRenewed(), before1);
BOOST_CHECK_LE(in1->getLastRenewed(), after1);
@@ -86,12 +86,12 @@
// insert out-record
time::steady_clock::TimePoint before2 = time::steady_clock::now();
- OutRecordCollection::iterator out1 = entry.insertOrUpdateOutRecord(face1, *interest1);
+ OutRecordCollection::iterator out1 = entry.insertOrUpdateOutRecord(*face1, *interest1);
time::steady_clock::TimePoint after2 = time::steady_clock::now();
const OutRecordCollection& outRecords2 = entry.getOutRecords();
BOOST_CHECK_EQUAL(outRecords2.size(), 1);
BOOST_CHECK(out1 == outRecords2.begin());
- BOOST_CHECK_EQUAL(out1->getFace(), face1);
+ BOOST_CHECK_EQUAL(&out1->getFace(), face1.get());
BOOST_CHECK_EQUAL(out1->getLastNonce(), interest1->getNonce());
BOOST_CHECK_GE(out1->getLastRenewed(), before2);
BOOST_CHECK_LE(out1->getLastRenewed(), after2);
@@ -102,27 +102,27 @@
// update in-record
time::steady_clock::TimePoint before3 = time::steady_clock::now();
- InRecordCollection::iterator in2 = entry.insertOrUpdateInRecord(face1, *interest2);
+ InRecordCollection::iterator in2 = entry.insertOrUpdateInRecord(*face1, *interest2);
time::steady_clock::TimePoint after3 = time::steady_clock::now();
const InRecordCollection& inRecords3 = entry.getInRecords();
BOOST_CHECK_EQUAL(inRecords3.size(), 1);
BOOST_CHECK(in2 == inRecords3.begin());
- BOOST_CHECK_EQUAL(in2->getFace(), face1);
+ BOOST_CHECK_EQUAL(&in2->getFace(), face1.get());
BOOST_CHECK_EQUAL(in2->getLastNonce(), interest2->getNonce());
BOOST_CHECK_LE(in2->getExpiry() - in2->getLastRenewed()
- interest2->getInterestLifetime(),
(after3 - before3));
// insert another in-record
- InRecordCollection::iterator in3 = entry.insertOrUpdateInRecord(face2, *interest3);
+ InRecordCollection::iterator in3 = entry.insertOrUpdateInRecord(*face2, *interest3);
const InRecordCollection& inRecords4 = entry.getInRecords();
BOOST_CHECK_EQUAL(inRecords4.size(), 2);
- BOOST_CHECK_EQUAL(in3->getFace(), face2);
+ BOOST_CHECK_EQUAL(&in3->getFace(), face2.get());
// get in-record
InRecordCollection::iterator in4 = entry.getInRecord(*face1);
BOOST_REQUIRE(in4 != entry.in_end());
- BOOST_CHECK_EQUAL(in4->getFace(), face1);
+ BOOST_CHECK_EQUAL(&in4->getFace(), face1.get());
// clear in-records
entry.clearInRecords();
@@ -132,21 +132,21 @@
// insert another out-record
OutRecordCollection::iterator out2 =
- entry.insertOrUpdateOutRecord(face2, *interest4);
+ entry.insertOrUpdateOutRecord(*face2, *interest4);
const OutRecordCollection& outRecords3 = entry.getOutRecords();
BOOST_CHECK_EQUAL(outRecords3.size(), 2);
- BOOST_CHECK_EQUAL(out2->getFace(), face2);
+ BOOST_CHECK_EQUAL(&out2->getFace(), face2.get());
// get out-record
OutRecordCollection::iterator out3 = entry.getOutRecord(*face1);
BOOST_REQUIRE(out3 != entry.out_end());
- BOOST_CHECK_EQUAL(out3->getFace(), face1);
+ BOOST_CHECK_EQUAL(&out3->getFace(), face1.get());
// delete out-record
entry.deleteOutRecord(*face2);
const OutRecordCollection& outRecords4 = entry.getOutRecords();
BOOST_REQUIRE_EQUAL(outRecords4.size(), 1);
- BOOST_CHECK_EQUAL(outRecords4.begin()->getFace(), face1);
+ BOOST_CHECK_EQUAL(&outRecords4.begin()->getFace(), face1.get());
BOOST_CHECK(entry.getOutRecord(*face2) == entry.out_end());
}
@@ -159,17 +159,17 @@
shared_ptr<Face> face = make_shared<DummyFace>();
Entry entry(*interest);
- InRecordCollection::iterator inIt = entry.insertOrUpdateInRecord(face, *interest);
+ InRecordCollection::iterator inIt = entry.insertOrUpdateInRecord(*face, *interest);
BOOST_CHECK_GT(inIt->getExpiry(), time::steady_clock::now());
- OutRecordCollection::iterator outIt = entry.insertOrUpdateOutRecord(face, *interest);
+ OutRecordCollection::iterator outIt = entry.insertOrUpdateOutRecord(*face, *interest);
BOOST_CHECK_GT(outIt->getExpiry(), time::steady_clock::now());
}
BOOST_AUTO_TEST_CASE(OutRecordNack)
{
shared_ptr<Face> face1 = make_shared<DummyFace>();
- OutRecord outR(face1);
+ OutRecord outR(*face1);
BOOST_CHECK(outR.getIncomingNack() == nullptr);
shared_ptr<Interest> interest1 = makeInterest("ndn:/uWiapGjYL");