tests: don't store shared_ptr<pit::Entry> in StrategyTester
refs #3205
Change-Id: I20ed5023fe07ba71d8df56a02228013acb8a8cb6
diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp
index 3a0ed29..ec6e951 100644
--- a/tests/daemon/fw/best-route-strategy2.t.cpp
+++ b/tests/daemon/fw/best-route-strategy2.t.cpp
@@ -207,10 +207,10 @@
strategy.afterReceiveInterest(*face1, *interest, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
- BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory[0].pitEntry, pitEntry);
+ BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory[0].pitInterest, pitEntry->getInterest());
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
- BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
+ BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].outFaceId, face1->getId());
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), lp::NackReason::NO_ROUTE);
}
@@ -238,9 +238,9 @@
strategy.afterReceiveNack(*face3, nack3, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 2);
- BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
+ BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), lp::NackReason::CONGESTION);
- BOOST_CHECK_EQUAL(strategy.sendNackHistory[1].pitEntry, pitEntry);
+ BOOST_CHECK_EQUAL(strategy.sendNackHistory[1].pitInterest, pitEntry->getInterest());
BOOST_CHECK_EQUAL(strategy.sendNackHistory[1].header.getReason(), lp::NackReason::CONGESTION);
std::unordered_set<FaceId> nackFaceIds{strategy.sendNackHistory[0].outFaceId,
strategy.sendNackHistory[1].outFaceId};
@@ -273,7 +273,7 @@
strategy.afterReceiveNack(*face4, nack4, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
- BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
+ BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].outFaceId, face1->getId());
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), lp::NackReason::CONGESTION);
}
@@ -446,7 +446,7 @@
strategy.afterReceiveNack(*face4, nack4, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
- BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
+ BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest, pitEntry->getInterest());
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-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index 3a2384f..3c4ef9b 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -56,8 +56,7 @@
Face& outFace,
bool wantNewNonce = false) override
{
- SendInterestArgs args{pitEntry, outFace.getId(), wantNewNonce};
- sendInterestHistory.push_back(args);
+ sendInterestHistory.push_back({pitEntry->getInterest(), outFace.getId(), wantNewNonce});
pitEntry->insertOrUpdateOutRecord(outFace, pitEntry->getInterest());
afterAction();
}
@@ -65,8 +64,7 @@
virtual void
rejectPendingInterest(const shared_ptr<pit::Entry>& pitEntry) override
{
- RejectPendingInterestArgs args{pitEntry};
- rejectPendingInterestHistory.push_back(args);
+ rejectPendingInterestHistory.push_back({pitEntry->getInterest()});
afterAction();
}
@@ -74,8 +72,7 @@
sendNack(const shared_ptr<pit::Entry>& pitEntry, const Face& outFace,
const lp::NackHeader& header) override
{
- SendNackArgs args{pitEntry, outFace.getId(), header};
- sendNackHistory.push_back(args);
+ sendNackHistory.push_back({pitEntry->getInterest(), outFace.getId(), header});
pitEntry->deleteInRecord(outFace);
afterAction();
}
@@ -83,7 +80,7 @@
public:
struct SendInterestArgs
{
- shared_ptr<pit::Entry> pitEntry;
+ Interest pitInterest;
FaceId outFaceId;
bool wantNewNonce;
};
@@ -91,13 +88,13 @@
struct RejectPendingInterestArgs
{
- shared_ptr<pit::Entry> pitEntry;
+ Interest pitInterest;
};
std::vector<RejectPendingInterestArgs> rejectPendingInterestHistory;
struct SendNackArgs
{
- shared_ptr<pit::Entry> pitEntry;
+ Interest pitInterest;
FaceId outFaceId;
lp::NackHeader header;
};