tests: avoid comparing Interests with operator==
Refs: #4569
Change-Id: Ia75169c147976d3980dd113054ba560caf0f33c8
diff --git a/tests/daemon/face/generic-link-service.t.cpp b/tests/daemon/face/generic-link-service.t.cpp
index 8f0dbae..612e6ee 100644
--- a/tests/daemon/face/generic-link-service.t.cpp
+++ b/tests/daemon/face/generic-link-service.t.cpp
@@ -163,7 +163,7 @@
BOOST_CHECK_EQUAL(service->getCounters().nInInterests, 1);
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
- BOOST_CHECK_EQUAL(receivedInterests.back(), *interest1);
+ BOOST_CHECK_EQUAL(receivedInterests.back().wireEncode(), interest1->wireEncode());
}
BOOST_AUTO_TEST_CASE(ReceiveInterest)
@@ -183,7 +183,7 @@
BOOST_CHECK_EQUAL(service->getCounters().nInInterests, 1);
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
- BOOST_CHECK_EQUAL(receivedInterests.back(), *interest1);
+ BOOST_CHECK_EQUAL(receivedInterests.back().wireEncode(), interest1->wireEncode());
}
BOOST_AUTO_TEST_CASE(ReceiveBareData)
@@ -198,7 +198,7 @@
BOOST_CHECK_EQUAL(service->getCounters().nInData, 1);
BOOST_REQUIRE_EQUAL(receivedData.size(), 1);
- BOOST_CHECK_EQUAL(receivedData.back(), *data1);
+ BOOST_CHECK_EQUAL(receivedData.back().wireEncode(), data1->wireEncode());
}
BOOST_AUTO_TEST_CASE(ReceiveData)
@@ -218,7 +218,7 @@
BOOST_CHECK_EQUAL(service->getCounters().nInData, 1);
BOOST_REQUIRE_EQUAL(receivedData.size(), 1);
- BOOST_CHECK_EQUAL(receivedData.back(), *data1);
+ BOOST_CHECK_EQUAL(receivedData.back().wireEncode(), data1->wireEncode());
}
BOOST_AUTO_TEST_CASE(ReceiveNack)
@@ -239,8 +239,8 @@
BOOST_CHECK_EQUAL(service->getCounters().nInNacks, 1);
BOOST_REQUIRE_EQUAL(receivedNacks.size(), 1);
- BOOST_CHECK(receivedNacks.back().getReason() == nack1.getReason());
- BOOST_CHECK(receivedNacks.back().getInterest() == nack1.getInterest());
+ BOOST_CHECK_EQUAL(receivedNacks.back().getReason(), nack1.getReason());
+ BOOST_CHECK_EQUAL(receivedNacks.back().getInterest().wireEncode(), nack1.getInterest().wireEncode());
}
BOOST_AUTO_TEST_CASE(ReceiveIdlePacket)
@@ -360,7 +360,7 @@
}
else {
BOOST_CHECK_EQUAL(receivedInterests.size(), 1);
- BOOST_CHECK_EQUAL(receivedInterests.back(), *interest);
+ BOOST_CHECK_EQUAL(receivedInterests.back().wireEncode(), interest->wireEncode());
BOOST_CHECK_EQUAL(service->getCounters().nReassembling, 0);
}
}
@@ -809,7 +809,7 @@
transport->receivePacket(packet.wireEncode());
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
- shared_ptr<lp::NextHopFaceIdTag> tag = receivedInterests.back().getTag<lp::NextHopFaceIdTag>();
+ auto tag = receivedInterests.back().getTag<lp::NextHopFaceIdTag>();
BOOST_REQUIRE(tag != nullptr);
BOOST_CHECK_EQUAL(*tag, 1000);
}
@@ -884,7 +884,7 @@
transport->receivePacket(packet.wireEncode());
BOOST_REQUIRE_EQUAL(receivedData.size(), 1);
- shared_ptr<lp::CachePolicyTag> tag = receivedData.back().getTag<lp::CachePolicyTag>();
+ auto tag = receivedData.back().getTag<lp::CachePolicyTag>();
BOOST_REQUIRE(tag != nullptr);
BOOST_CHECK_EQUAL(tag->get().getPolicy(), lp::CachePolicyType::NO_CACHE);
}
@@ -1069,7 +1069,7 @@
transport->receivePacket(packet.wireEncode());
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
- shared_ptr<lp::CongestionMarkTag> tag = receivedInterests.back().getTag<lp::CongestionMarkTag>();
+ auto tag = receivedInterests.back().getTag<lp::CongestionMarkTag>();
BOOST_REQUIRE(tag != nullptr);
BOOST_CHECK_EQUAL(*tag, 1);
}
@@ -1083,7 +1083,7 @@
transport->receivePacket(packet.wireEncode());
BOOST_REQUIRE_EQUAL(receivedData.size(), 1);
- shared_ptr<lp::CongestionMarkTag> tag = receivedData.back().getTag<lp::CongestionMarkTag>();
+ auto tag = receivedData.back().getTag<lp::CongestionMarkTag>();
BOOST_REQUIRE(tag != nullptr);
BOOST_CHECK_EQUAL(*tag, 1);
}
@@ -1101,7 +1101,7 @@
transport->receivePacket(packet.wireEncode());
BOOST_REQUIRE_EQUAL(receivedNacks.size(), 1);
- shared_ptr<lp::CongestionMarkTag> tag = receivedNacks.back().getTag<lp::CongestionMarkTag>();
+ auto tag = receivedNacks.back().getTag<lp::CongestionMarkTag>();
BOOST_REQUIRE(tag != nullptr);
BOOST_CHECK_EQUAL(*tag, 1);
}
@@ -1151,7 +1151,7 @@
transport->receivePacket(packet.wireEncode());
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
- shared_ptr<lp::NonDiscoveryTag> tag = receivedInterests.back().getTag<lp::NonDiscoveryTag>();
+ auto tag = receivedInterests.back().getTag<lp::NonDiscoveryTag>();
BOOST_CHECK(tag != nullptr);
}
@@ -1169,8 +1169,7 @@
BOOST_CHECK_EQUAL(service->getCounters().nInNetInvalid, 0); // not an error
BOOST_CHECK_EQUAL(receivedInterests.size(), 1);
-
- shared_ptr<lp::NonDiscoveryTag> tag = receivedInterests.back().getTag<lp::NonDiscoveryTag>();
+ auto tag = receivedInterests.back().getTag<lp::NonDiscoveryTag>();
BOOST_CHECK(tag == nullptr);
}
@@ -1258,7 +1257,7 @@
transport->receivePacket(packet.wireEncode());
BOOST_REQUIRE_EQUAL(receivedData.size(), 1);
- shared_ptr<lp::PrefixAnnouncementTag> tag = receivedData.back().getTag<lp::PrefixAnnouncementTag>();
+ auto tag = receivedData.back().getTag<lp::PrefixAnnouncementTag>();
BOOST_CHECK_EQUAL(tag->get().getPrefixAnn()->getAnnouncedName(), "/local/ndn/prefix");
}
@@ -1277,8 +1276,7 @@
BOOST_CHECK_EQUAL(service->getCounters().nInNetInvalid, 0); // not an error
BOOST_CHECK_EQUAL(receivedData.size(), 1);
-
- shared_ptr<lp::PrefixAnnouncementTag> tag = receivedData.back().getTag<lp::PrefixAnnouncementTag>();
+ auto tag = receivedData.back().getTag<lp::PrefixAnnouncementTag>();
BOOST_CHECK(tag == nullptr);
}
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index 4c2d8d0..247821a 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -504,7 +504,7 @@
auto interest2a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, nullopt, 732);
face2->receiveInterest(*interest2a, 0);
BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1);
- BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest(), *interest2a);
+ BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest().wireEncode(), interest2a->wireEncode());
BOOST_CHECK_EQUAL(face2->sentNacks.back().getReason(), lp::NackReason::DUPLICATE);
// receive Interest with new Nonce on face2
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index 41b59e2..df2c1bb 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -107,17 +107,21 @@
lp::Nack nack3 = makeNack(*interest1, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*this->face3, 0)->setIncomingNack(nack3);
- BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->face3, 0), nack3, pitEntry); },
- this->limitedIo, 2));
+ auto f = [&] {
+ this->strategy.afterReceiveNack(FaceEndpoint(*this->face3, 0), nack3, pitEntry);
+ };
+ BOOST_REQUIRE(this->strategy.waitForAction(f, this->limitedIo, 2));
BOOST_REQUIRE_EQUAL(this->strategy.sendNackHistory.size(), 2);
- BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
+ BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[0].pitInterest.wireEncode(),
+ pitEntry->getInterest().wireEncode());
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[0].header.getReason(), lp::NackReason::CONGESTION);
- BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[1].pitInterest, pitEntry->getInterest());
+ BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[1].pitInterest.wireEncode(),
+ pitEntry->getInterest().wireEncode());
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[1].header.getReason(), lp::NackReason::CONGESTION);
+
std::set<FaceId> nackFaceIds{this->strategy.sendNackHistory[0].outFaceId,
- this->strategy.sendNackHistory[1].outFaceId};
+ this->strategy.sendNackHistory[1].outFaceId};
std::set<FaceId> expectedNackFaceIds{this->face1->getId(), this->face2->getId()};
BOOST_CHECK_EQUAL_COLLECTIONS(nackFaceIds.begin(), nackFaceIds.end(),
expectedNackFaceIds.begin(), expectedNackFaceIds.end());
@@ -146,12 +150,15 @@
lp::Nack nack4 = makeNack(*interest1, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*this->face4, 0)->setIncomingNack(nack4);
- BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->face4, 0), nack4, pitEntry); },
- this->limitedIo));
+
+ auto f = [&] {
+ this->strategy.afterReceiveNack(FaceEndpoint(*this->face4, 0), nack4, pitEntry);
+ };
+ BOOST_REQUIRE(this->strategy.waitForAction(f, this->limitedIo));
BOOST_REQUIRE_EQUAL(this->strategy.sendNackHistory.size(), 1);
- BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
+ BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[0].pitInterest.wireEncode(),
+ pitEntry->getInterest().wireEncode());
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[0].outFaceId, this->face1->getId());
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[0].header.getReason(), lp::NackReason::CONGESTION);
}
@@ -334,7 +341,8 @@
strategy.afterReceiveNack(FaceEndpoint(*face4, 0), nack4, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
- BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
+ BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest.wireEncode(),
+ pitEntry->getInterest().wireEncode());
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].outFaceId, face1->getId());
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), Combination::getExpectedResult());
}
diff --git a/tests/daemon/fw/strategy-no-route.t.cpp b/tests/daemon/fw/strategy-no-route.t.cpp
index d554d47..cea980f 100644
--- a/tests/daemon/fw/strategy-no-route.t.cpp
+++ b/tests/daemon/fw/strategy-no-route.t.cpp
@@ -157,19 +157,22 @@
typename T::Case scenario;
scenario.insertFibEntry(this);
- shared_ptr<Interest> interest = makeInterest(scenario.getInterestName());
- shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
+ auto interest = makeInterest(scenario.getInterestName());
+ auto pitEntry = this->pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*this->face1, 0, *interest);
- BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->face1, 0), *interest, pitEntry); },
- this->limitedIo, 2));
+ auto f = [&] {
+ this->strategy.afterReceiveInterest(FaceEndpoint(*this->face1, 0), *interest, pitEntry);
+ };
+ BOOST_REQUIRE(this->strategy.waitForAction(f, this->limitedIo, 2));
BOOST_REQUIRE_EQUAL(this->strategy.rejectPendingInterestHistory.size(), 1);
- BOOST_CHECK_EQUAL(this->strategy.rejectPendingInterestHistory[0].pitInterest, pitEntry->getInterest());
+ BOOST_CHECK_EQUAL(this->strategy.rejectPendingInterestHistory[0].pitInterest.wireEncode(),
+ pitEntry->getInterest().wireEncode());
BOOST_REQUIRE_EQUAL(this->strategy.sendNackHistory.size(), 1);
- BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
+ BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[0].pitInterest.wireEncode(),
+ pitEntry->getInterest().wireEncode());
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[0].outFaceId, this->face1->getId());
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory[0].header.getReason(), lp::NackReason::NO_ROUTE);
}
diff --git a/tests/daemon/table/name-tree.t.cpp b/tests/daemon/table/name-tree.t.cpp
index 6c2f627..d51474d 100644
--- a/tests/daemon/table/name-tree.t.cpp
+++ b/tests/daemon/table/name-tree.t.cpp
@@ -260,7 +260,7 @@
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);
+ BOOST_CHECK(&npe.getPitEntries().front()->getInterest() == interest2.get());
npe.erasePitEntry(pit2.get());
BOOST_CHECK_EQUAL(npe.hasPitEntries(), false);
diff --git a/tests/daemon/table/pit.t.cpp b/tests/daemon/table/pit.t.cpp
index 99d23e7..ca9ac3c 100644
--- a/tests/daemon/table/pit.t.cpp
+++ b/tests/daemon/table/pit.t.cpp
@@ -319,8 +319,8 @@
pit.insert(*interestABC1);
BOOST_CHECK_EQUAL(pit.size(), 1);
BOOST_CHECK(pit.begin() != pit.end());
- BOOST_CHECK(pit.begin()->getInterest() == *interestABC1);
- BOOST_CHECK((*pit.begin()).getInterest() == *interestABC1);
+ BOOST_CHECK(&pit.begin()->getInterest() == interestABC1.get());
+ BOOST_CHECK(&(*pit.begin()).getInterest() == interestABC1.get());
auto i = pit.begin();
auto j = pit.begin();