table: simplify PIT with C++11 features
refs #2100
Change-Id: I1159761d9439f0a2ff9f6463f89f39372a696e48
diff --git a/tests/daemon/table/pit.cpp b/tests/daemon/table/pit.cpp
index 8e73a12..dcf5053 100644
--- a/tests/daemon/table/pit.cpp
+++ b/tests/daemon/table/pit.cpp
@@ -77,7 +77,7 @@
BOOST_CHECK_LE(in1->getExpiry() - in1->getLastRenewed()
- interest1->getInterestLifetime(),
(after1 - before1));
- BOOST_CHECK(in1 == entry.getInRecord(face1));
+ BOOST_CHECK(in1 == entry.getInRecord(*face1));
// insert OutRecord
time::steady_clock::TimePoint before2 = time::steady_clock::now();
@@ -94,7 +94,7 @@
BOOST_CHECK_LE(out1->getExpiry() - out1->getLastRenewed()
- interest1->getInterestLifetime(),
(after2 - before2));
- BOOST_CHECK(out1 == entry.getOutRecord(face1));
+ BOOST_CHECK(out1 == entry.getOutRecord(*face1));
// update InRecord
time::steady_clock::TimePoint before3 = time::steady_clock::now();
@@ -118,7 +118,7 @@
BOOST_CHECK_EQUAL(in3->getFace(), face2);
// get InRecord
- pit::InRecordCollection::const_iterator in4 = entry.getInRecord(face1);
+ pit::InRecordCollection::const_iterator in4 = entry.getInRecord(*face1);
BOOST_REQUIRE(in4 != entry.getInRecords().end());
BOOST_CHECK_EQUAL(in4->getFace(), face1);
@@ -126,7 +126,7 @@
entry.deleteInRecords();
const pit::InRecordCollection& inRecords5 = entry.getInRecords();
BOOST_CHECK_EQUAL(inRecords5.size(), 0);
- BOOST_CHECK(entry.getInRecord(face1) == entry.getInRecords().end());
+ BOOST_CHECK(entry.getInRecord(*face1) == entry.getInRecords().end());
// insert another OutRecord
pit::OutRecordCollection::iterator out2 =
@@ -136,16 +136,16 @@
BOOST_CHECK_EQUAL(out2->getFace(), face2);
// get OutRecord
- pit::OutRecordCollection::const_iterator out3 = entry.getOutRecord(face1);
+ pit::OutRecordCollection::const_iterator out3 = entry.getOutRecord(*face1);
BOOST_REQUIRE(out3 != entry.getOutRecords().end());
BOOST_CHECK_EQUAL(out3->getFace(), face1);
// delete OutRecord
- entry.deleteOutRecord(face2);
+ entry.deleteOutRecord(*face2);
const pit::OutRecordCollection& outRecords4 = entry.getOutRecords();
BOOST_REQUIRE_EQUAL(outRecords4.size(), 1);
BOOST_CHECK_EQUAL(outRecords4.begin()->getFace(), face1);
- BOOST_CHECK(entry.getOutRecord(face2) == entry.getOutRecords().end());
+ BOOST_CHECK(entry.getOutRecord(*face2) == entry.getOutRecords().end());
}
BOOST_AUTO_TEST_CASE(EntryNonce)
@@ -419,17 +419,15 @@
shared_ptr<Data> data = makeData(nameABCD);
- shared_ptr<pit::DataMatchResult> matches = pit.findAllDataMatches(*data);
+ pit::DataMatchResult matches = pit.findAllDataMatches(*data);
bool hasA = false;
bool hasAB = false;
bool hasABC = false;
bool hasD = false;
- for (pit::DataMatchResult::iterator it = matches->begin();
- it != matches->end(); ++it) {
+ for (const shared_ptr<pit::Entry>& entry : matches) {
++count;
- shared_ptr<pit::Entry> entry = *it;
if (entry->getName().equals(nameA ))
hasA = true;