tests: set CanBePrefix in daemon tests
This commit also updates makeInterest and makeNack functions
so that their APIs are compatible with ndn-cxx test suite.
refs #4581
Change-Id: I0c81740416c26a03450dc3a12c89944b72ce5901
diff --git a/tests/daemon/face/face.t.cpp b/tests/daemon/face/face.t.cpp
index 165d5db..346f609 100644
--- a/tests/daemon/face/face.t.cpp
+++ b/tests/daemon/face/face.t.cpp
@@ -106,33 +106,29 @@
face1->afterReceiveNack.connect(bind([&nReceivedNacks] { ++nReceivedNacks; }));
for (size_t i = 0; i < nInInterests; ++i) {
- shared_ptr<Interest> interest = makeInterest("/JSQdqward4");
- face1->receiveInterest(*interest, 0);
+ face1->receiveInterest(*makeInterest("/JSQdqward4"), 0);
}
for (size_t i = 0; i < nInData; ++i) {
- shared_ptr<Data> data = makeData("/hT8FDigWn1");
- face1->receiveData(*data, 0);
+ face1->receiveData(*makeData("/hT8FDigWn1"), 0);
}
for (size_t i = 0; i < nInNacks; ++i) {
- lp::Nack nack = makeNack("/StnEVTj4Ex", 561, lp::NackReason::CONGESTION);
- face1->receiveNack(nack, 0);
+ face1->receiveNack(makeNack(*makeInterest("/StnEVTj4Ex", false, nullopt, 561),
+ lp::NackReason::CONGESTION), 0);
}
for (size_t i = 0; i < nOutInterests; ++i) {
- shared_ptr<Interest> interest = makeInterest("/XyUAFYQDmd");
- face1->sendInterest(*interest, 0);
+ face1->sendInterest(*makeInterest("/XyUAFYQDmd"), 0);
}
for (size_t i = 0; i < nOutData; ++i) {
- shared_ptr<Data> data = makeData("/GigPEtPH6");
- face1->sendData(*data, 0);
+ face1->sendData(*makeData("/GigPEtPH6"), 0);
}
for (size_t i = 0; i < nOutNacks; ++i) {
- lp::Nack nack = makeNack("/9xK6FbwIBM", 365, lp::NackReason::CONGESTION);
- face1->sendNack(nack, 0);
+ face1->sendNack(makeNack(*makeInterest("/9xK6FbwIBM", false, nullopt, 365),
+ lp::NackReason::CONGESTION), 0);
}
BOOST_CHECK_EQUAL(face1->getCounters().nInInterests, nInInterests);
diff --git a/tests/daemon/face/generic-link-service.t.cpp b/tests/daemon/face/generic-link-service.t.cpp
index fc5efc2..8f0dbae 100644
--- a/tests/daemon/face/generic-link-service.t.cpp
+++ b/tests/daemon/face/generic-link-service.t.cpp
@@ -139,7 +139,8 @@
options.allowLocalFields = false;
initialize(options);
- auto nack1 = makeNack("/localhost/test", 323, lp::NackReason::NO_ROUTE);
+ auto nack1 = makeNack(*makeInterest("/localhost/test", false, nullopt, 323),
+ lp::NackReason::NO_ROUTE);
face->sendNack(nack1, 0);
BOOST_CHECK_EQUAL(service->getCounters().nOutNacks, 1);
@@ -172,7 +173,7 @@
options.allowLocalFields = false;
initialize(options);
- shared_ptr<Interest> interest1 = makeInterest("/23Rd9hEiR");
+ auto interest1 = makeInterest("/23Rd9hEiR");
lp::Packet lpPacket;
lpPacket.set<lp::FragmentField>(std::make_pair(
interest1->wireEncode().begin(), interest1->wireEncode().end()));
@@ -207,7 +208,7 @@
options.allowLocalFields = false;
initialize(options);
- shared_ptr<Data> data1 = makeData("/12345689");
+ auto data1 = makeData("/12345689");
lp::Packet lpPacket;
lpPacket.set<lp::FragmentField>(std::make_pair(
data1->wireEncode().begin(), data1->wireEncode().end()));
@@ -227,7 +228,8 @@
options.allowLocalFields = false;
initialize(options);
- lp::Nack nack1 = makeNack("/localhost/test", 323, lp::NackReason::NO_ROUTE);
+ lp::Nack nack1 = makeNack(*makeInterest("/localhost/test", false, nullopt, 323),
+ lp::NackReason::NO_ROUTE);
lp::Packet lpPacket;
lpPacket.set<lp::FragmentField>(std::make_pair(
nack1.getInterest().wireEncode().begin(), nack1.getInterest().wireEncode().end()));
@@ -273,7 +275,7 @@
transport->setMtu(55);
- shared_ptr<Data> data = makeData("/test/data/123456789/987654321/123456789");
+ auto data = makeData("/test/data/123456789/987654321/123456789");
face->sendData(*data, 0);
BOOST_CHECK_EQUAL(transport->sentPackets.size(), 0);
@@ -289,7 +291,7 @@
transport->setMtu(MTU_UNLIMITED);
- shared_ptr<Data> data = makeData("/test/data/123456789/987654321/123456789");
+ auto data = makeData("/test/data/123456789/987654321/123456789");
face->sendData(*data, 0);
BOOST_CHECK_EQUAL(transport->sentPackets.size(), 1);
@@ -304,7 +306,7 @@
transport->setMtu(105);
- shared_ptr<Data> data = makeData("/test/data/123456789/987654321/123456789");
+ auto data = makeData("/test/data/123456789/987654321/123456789");
face->sendData(*data, 0);
BOOST_CHECK_EQUAL(transport->sentPackets.size(), 1);
@@ -319,7 +321,7 @@
transport->setMtu(60);
- shared_ptr<Data> data = makeData("/test/data/123456789/987654321/123456789");
+ auto data = makeData("/test/data/123456789/987654321/123456789");
face->sendData(*data, 0);
BOOST_CHECK_GT(transport->sentPackets.size(), 1);
@@ -332,7 +334,7 @@
options.allowReassembly = true;
initialize(options);
- shared_ptr<Interest> interest = makeInterest(
+ auto interest = makeInterest(
"/mt7P130BHXmtLm5dwaY5dpUM6SWYNN2B05g7y3UhsQuLvDdnTWdNnTeEiLuW3FAbJRSG3tzQ0UfaSEgG9rvYHmsKtgPMag1Hj4Tr");
lp::Packet packet(interest->wireEncode());
@@ -371,7 +373,7 @@
options.allowReassembly = false;
initialize(options);
- shared_ptr<Interest> interest = makeInterest("/IgFe6NvH");
+ auto interest = makeInterest("/IgFe6NvH");
lp::Packet packet(interest->wireEncode());
packet.set<lp::FragIndexField>(140);
@@ -388,7 +390,7 @@
options.allowReassembly = false;
initialize(options);
- shared_ptr<Interest> interest = makeInterest("/SeGmEjvIVX");
+ auto interest = makeInterest("/SeGmEjvIVX");
lp::Packet packet(interest->wireEncode());
packet.set<lp::FragCountField>(276);
@@ -446,7 +448,8 @@
options.reliabilityOptions.isEnabled = true;
initialize(options);
- auto nack1 = makeNack("/localhost/test", 323, lp::NackReason::NO_ROUTE);
+ auto nack1 = makeNack(*makeInterest("/localhost/test", false, nullopt, 323),
+ lp::NackReason::NO_ROUTE);
face->sendNack(nack1, 0);
BOOST_CHECK_EQUAL(service->getCounters().nOutNacks, 1);
@@ -472,7 +475,7 @@
BOOST_CHECK_EQUAL(service->m_nMarkedSinceInMarkingState, 0);
BOOST_CHECK_EQUAL(service->getCounters().nCongestionMarked, 0);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
// congestion threshold will be 32768 bytes, since min(65536, 65536 / 2) = 32768 bytes
@@ -508,7 +511,7 @@
BOOST_CHECK_EQUAL(service->m_nMarkedSinceInMarkingState, 0);
BOOST_CHECK_EQUAL(service->getCounters().nCongestionMarked, 0);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
// congestion threshold will be 32768 bytes, since min(65536, 65536 / 2) = 32768 bytes
@@ -750,7 +753,7 @@
BOOST_CHECK_EQUAL(service->m_nMarkedSinceInMarkingState, 0);
BOOST_CHECK_EQUAL(service->getCounters().nCongestionMarked, 0);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
// congestion threshold will be 65536 bytes, since the transport reports that it cannot measure
// the queue capacity
@@ -799,7 +802,7 @@
options.allowLocalFields = true;
initialize(options);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
lp::Packet packet(interest->wireEncode());
packet.set<lp::NextHopFaceIdField>(1000);
@@ -818,7 +821,7 @@
options.allowLocalFields = false;
initialize(options);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
lp::Packet packet(interest->wireEncode());
packet.set<lp::NextHopFaceIdField>(1000);
@@ -835,7 +838,7 @@
options.allowLocalFields = true;
initialize(options);
- shared_ptr<Data> data = makeData("/12345678");
+ auto data = makeData("/12345678");
lp::Packet packet(data->wireEncode());
packet.set<lp::NextHopFaceIdField>(1000);
@@ -852,7 +855,8 @@
options.allowLocalFields = true;
initialize(options);
- lp::Nack nack = makeNack("/localhost/test", 123, lp::NackReason::NO_ROUTE);
+ lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, nullopt, 123),
+ lp::NackReason::NO_ROUTE);
lp::Packet packet;
packet.set<lp::FragmentField>(std::make_pair(
nack.getInterest().wireEncode().begin(), nack.getInterest().wireEncode().end()));
@@ -873,7 +877,7 @@
initialize(options);
// CachePolicy is unprivileged and does not require allowLocalFields option.
- shared_ptr<Data> data = makeData("/12345678");
+ auto data = makeData("/12345678");
lp::Packet packet(data->wireEncode());
packet.set<lp::CachePolicyField>(lp::CachePolicy().setPolicy(lp::CachePolicyType::NO_CACHE));
@@ -892,7 +896,7 @@
options.allowLocalFields = true;
initialize(options);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
lp::Packet packet(interest->wireEncode());
lp::CachePolicy policy;
policy.setPolicy(lp::CachePolicyType::NO_CACHE);
@@ -911,7 +915,8 @@
options.allowLocalFields = true;
initialize(options);
- lp::Nack nack = makeNack("/localhost/test", 123, lp::NackReason::NO_ROUTE);
+ lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, nullopt, 123),
+ lp::NackReason::NO_ROUTE);
lp::Packet packet(nack.getInterest().wireEncode());
packet.set<lp::NackField>(nack.getHeader());
lp::CachePolicy policy;
@@ -931,7 +936,7 @@
options.allowLocalFields = true;
initialize(options);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
interest->setTag(make_shared<lp::IncomingFaceIdTag>(1000));
face->sendInterest(*interest, 0);
@@ -949,7 +954,7 @@
options.allowLocalFields = false;
initialize(options);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
interest->setTag(make_shared<lp::IncomingFaceIdTag>(1000));
face->sendInterest(*interest, 0);
@@ -966,7 +971,7 @@
options.allowLocalFields = true;
initialize(options);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
lp::Packet packet(interest->wireEncode());
packet.set<lp::IncomingFaceIdField>(1000);
@@ -984,7 +989,7 @@
options.allowLocalFields = true;
initialize(options);
- shared_ptr<Data> data = makeData("/z1megUh9Bj");
+ auto data = makeData("/z1megUh9Bj");
lp::Packet packet(data->wireEncode());
packet.set<lp::IncomingFaceIdField>(1000);
@@ -1002,7 +1007,8 @@
options.allowLocalFields = true;
initialize(options);
- lp::Nack nack = makeNack("/TPAhdiHz", 278, lp::NackReason::CONGESTION);
+ lp::Nack nack = makeNack(*makeInterest("/TPAhdiHz", false, nullopt, 278),
+ lp::NackReason::CONGESTION);
lp::Packet packet(nack.getInterest().wireEncode());
packet.set<lp::NackField>(nack.getHeader());
packet.set<lp::IncomingFaceIdField>(1000);
@@ -1016,7 +1022,7 @@
BOOST_AUTO_TEST_CASE(SendCongestionMarkInterest)
{
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
interest->setTag(make_shared<lp::CongestionMarkTag>(1));
face->sendInterest(*interest, 0);
@@ -1029,7 +1035,7 @@
BOOST_AUTO_TEST_CASE(SendCongestionMarkData)
{
- shared_ptr<Data> data = makeData("/12345678");
+ auto data = makeData("/12345678");
data->setTag(make_shared<lp::CongestionMarkTag>(0));
face->sendData(*data, 0);
@@ -1042,7 +1048,8 @@
BOOST_AUTO_TEST_CASE(SendCongestionMarkNack)
{
- lp::Nack nack = makeNack("/localhost/test", 123, lp::NackReason::NO_ROUTE);
+ lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, nullopt, 123),
+ lp::NackReason::NO_ROUTE);
nack.setTag(make_shared<lp::CongestionMarkTag>(std::numeric_limits<uint64_t>::max()));
face->sendNack(nack, 0);
@@ -1055,7 +1062,7 @@
BOOST_AUTO_TEST_CASE(ReceiveCongestionMarkInterest)
{
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
lp::Packet packet(interest->wireEncode());
packet.set<lp::CongestionMarkField>(1);
@@ -1069,7 +1076,7 @@
BOOST_AUTO_TEST_CASE(ReceiveCongestionMarkData)
{
- shared_ptr<Data> data = makeData("/12345678");
+ auto data = makeData("/12345678");
lp::Packet packet(data->wireEncode());
packet.set<lp::CongestionMarkField>(1);
@@ -1083,7 +1090,8 @@
BOOST_AUTO_TEST_CASE(ReceiveCongestionMarkNack)
{
- lp::Nack nack = makeNack("/localhost/test", 123, lp::NackReason::NO_ROUTE);
+ lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, nullopt, 123),
+ lp::NackReason::NO_ROUTE);
lp::Packet packet;
packet.set<lp::FragmentField>(std::make_pair(
nack.getInterest().wireEncode().begin(), nack.getInterest().wireEncode().end()));
@@ -1104,7 +1112,7 @@
options.allowSelfLearning = true;
initialize(options);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
interest->setTag(make_shared<lp::NonDiscoveryTag>(lp::EmptyValue{}));
face->sendInterest(*interest, 0);
@@ -1120,7 +1128,7 @@
options.allowSelfLearning = false;
initialize(options);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
interest->setTag(make_shared<lp::NonDiscoveryTag>(lp::EmptyValue{}));
face->sendInterest(*interest, 0);
@@ -1136,7 +1144,7 @@
options.allowSelfLearning = true;
initialize(options);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
lp::Packet packet(interest->wireEncode());
packet.set<lp::NonDiscoveryField>(lp::EmptyValue{});
@@ -1153,7 +1161,7 @@
options.allowSelfLearning = false;
initialize(options);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
lp::Packet packet(interest->wireEncode());
packet.set<lp::NonDiscoveryField>(lp::EmptyValue{});
@@ -1172,7 +1180,7 @@
options.allowSelfLearning = true;
initialize(options);
- shared_ptr<Data> data = makeData("/12345678");
+ auto data = makeData("/12345678");
lp::Packet packet(data->wireEncode());
packet.set<lp::NonDiscoveryField>(lp::EmptyValue{});
@@ -1188,7 +1196,8 @@
options.allowSelfLearning = true;
initialize(options);
- lp::Nack nack = makeNack("/localhost/test", 123, lp::NackReason::NO_ROUTE);
+ lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, nullopt, 123),
+ lp::NackReason::NO_ROUTE);
lp::Packet packet;
packet.set<lp::FragmentField>(std::make_pair(
nack.getInterest().wireEncode().begin(), nack.getInterest().wireEncode().end()));
@@ -1207,7 +1216,7 @@
options.allowSelfLearning = true;
initialize(options);
- shared_ptr<Data> data = makeData("/12345678");
+ auto data = makeData("/12345678");
auto pah = makePrefixAnnHeader("/local/ndn/prefix");
data->setTag(make_shared<lp::PrefixAnnouncementTag>(pah));
@@ -1224,7 +1233,7 @@
options.allowSelfLearning = false;
initialize(options);
- shared_ptr<Data> data = makeData("/12345678");
+ auto data = makeData("/12345678");
auto pah = makePrefixAnnHeader("/local/ndn/prefix");
data->setTag(make_shared<lp::PrefixAnnouncementTag>(pah));
@@ -1241,7 +1250,7 @@
options.allowSelfLearning = true;
initialize(options);
- shared_ptr<Data> data = makeData("/12345678");
+ auto data = makeData("/12345678");
lp::Packet packet(data->wireEncode());
auto pah = makePrefixAnnHeader("/local/ndn/prefix");
packet.set<lp::PrefixAnnouncementField>(pah);
@@ -1259,7 +1268,7 @@
options.allowSelfLearning = false;
initialize(options);
- shared_ptr<Data> data = makeData("/12345678");
+ auto data = makeData("/12345678");
lp::Packet packet(data->wireEncode());
auto pah = makePrefixAnnHeader("/local/ndn/prefix");
packet.set<lp::PrefixAnnouncementField>(pah);
@@ -1279,7 +1288,7 @@
options.allowSelfLearning = true;
initialize(options);
- shared_ptr<Interest> interest = makeInterest("/12345678");
+ auto interest = makeInterest("/12345678");
lp::Packet packet(interest->wireEncode());
auto pah = makePrefixAnnHeader("/local/ndn/prefix");
packet.set<lp::PrefixAnnouncementField>(pah);
@@ -1296,7 +1305,8 @@
options.allowSelfLearning = true;
initialize(options);
- lp::Nack nack = makeNack("/localhost/test", 123, lp::NackReason::NO_ROUTE);
+ lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, nullopt, 123),
+ lp::NackReason::NO_ROUTE);
lp::Packet packet;
packet.set<lp::FragmentField>(std::make_pair(
nack.getInterest().wireEncode().begin(), nack.getInterest().wireEncode().end()));
diff --git a/tests/daemon/face/internal-face.t.cpp b/tests/daemon/face/internal-face.t.cpp
index a830e3e..bab5ea5 100644
--- a/tests/daemon/face/internal-face.t.cpp
+++ b/tests/daemon/face/internal-face.t.cpp
@@ -102,7 +102,7 @@
BOOST_AUTO_TEST_CASE(ReceiveInterestSendData)
{
- auto interest = makeInterest("/PQstEJGdL");
+ auto interest = makeInterest("/PQstEJGdL", true);
bool hasReceivedData = false;
clientFace->expressInterest(*interest,
@@ -125,7 +125,7 @@
BOOST_AUTO_TEST_CASE(ReceiveInterestSendNack)
{
- auto interest = makeInterest("/1HrsRM1X", 152);
+ auto interest = makeInterest("/1HrsRM1X");
bool hasReceivedNack = false;
clientFace->expressInterest(*interest,
@@ -140,7 +140,7 @@
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
BOOST_CHECK_EQUAL(receivedInterests.back().getName(), "/1HrsRM1X");
- forwarderFace->sendNack(makeNack("/1HrsRM1X", 152, lp::NackReason::NO_ROUTE), 0);
+ forwarderFace->sendNack(makeNack(*interest, lp::NackReason::NO_ROUTE), 0);
this->advanceClocks(1_ms, 10);
BOOST_CHECK(hasReceivedNack);
@@ -157,7 +157,7 @@
clientFace->put(*makeData("/Wpc8TnEeoF/f6SzV8hD/3uytUJCuIi"));
});
- forwarderFace->sendInterest(*makeInterest("/Wpc8TnEeoF/f6SzV8hD"), 0);
+ forwarderFace->sendInterest(*makeInterest("/Wpc8TnEeoF/f6SzV8hD", true), 0);
this->advanceClocks(1_ms, 10);
BOOST_CHECK(hasDeliveredInterest);
@@ -167,16 +167,17 @@
BOOST_AUTO_TEST_CASE(SendInterestReceiveNack)
{
+ auto interest = makeInterest("/4YgJKWcXN/5oaTe05o");
+
bool hasDeliveredInterest = false;
clientFace->setInterestFilter("/4YgJKWcXN",
[this, &hasDeliveredInterest] (const ndn::InterestFilter&, const Interest& interest) {
hasDeliveredInterest = true;
BOOST_CHECK_EQUAL(interest.getName(), "/4YgJKWcXN/5oaTe05o");
-
- clientFace->put(makeNack("/4YgJKWcXN/5oaTe05o", 191, lp::NackReason::NO_ROUTE));
+ clientFace->put(makeNack(interest, lp::NackReason::NO_ROUTE));
});
- forwarderFace->sendInterest(*makeInterest("/4YgJKWcXN/5oaTe05o", 191), 0);
+ forwarderFace->sendInterest(*interest, 0);
this->advanceClocks(1_ms, 10);
BOOST_CHECK(hasDeliveredInterest);
diff --git a/tests/daemon/face/lp-reliability.t.cpp b/tests/daemon/face/lp-reliability.t.cpp
index a4ec6d3..5e73c03 100644
--- a/tests/daemon/face/lp-reliability.t.cpp
+++ b/tests/daemon/face/lp-reliability.t.cpp
@@ -56,6 +56,7 @@
{
if (frags.front().has<lp::FragmentField>()) {
Interest interest("/test/prefix");
+ interest.setCanBePrefix(false);
lp::Packet pkt;
pkt.add<lp::FragmentField>(make_pair(interest.wireEncode().begin(), interest.wireEncode().end()));
m_reliability.handleOutgoing(frags, std::move(pkt), true);
diff --git a/tests/daemon/fw/algorithm.t.cpp b/tests/daemon/fw/algorithm.t.cpp
index 96284f3..3ec11da 100644
--- a/tests/daemon/fw/algorithm.t.cpp
+++ b/tests/daemon/fw/algorithm.t.cpp
@@ -60,7 +60,7 @@
BOOST_AUTO_TEST_CASE(Unrestricted)
{
- shared_ptr<Interest> interest = makeInterest("ndn:/ieWRzDsCu");
+ auto interest = makeInterest("ndn:/ieWRzDsCu");
BOOST_CHECK_EQUAL(wouldViolateScope(*nonLocalFace1, *interest, *nonLocalFace2), false);
BOOST_CHECK_EQUAL(wouldViolateScope(*nonLocalFace1, *interest, *localFace4), false);
@@ -70,7 +70,7 @@
BOOST_AUTO_TEST_CASE(Localhost)
{
- shared_ptr<Interest> interest = makeInterest("ndn:/localhost/5n1LzIt3");
+ auto interest = makeInterest("ndn:/localhost/5n1LzIt3");
// /localhost Interests from non-local faces should be rejected by incoming Interest pipeline,
// and are not tested here.
@@ -80,7 +80,7 @@
BOOST_AUTO_TEST_CASE(Localhop)
{
- shared_ptr<Interest> interest = makeInterest("ndn:/localhop/YcIKWCRYJ");
+ auto interest = makeInterest("ndn:/localhop/YcIKWCRYJ");
BOOST_CHECK_EQUAL(wouldViolateScope(*nonLocalFace1, *interest, *nonLocalFace2), true);
BOOST_CHECK_EQUAL(wouldViolateScope(*nonLocalFace1, *interest, *localFace4), false);
@@ -92,7 +92,7 @@
BOOST_AUTO_TEST_CASE(CanForwardToLegacy)
{
- shared_ptr<Interest> interest = makeInterest("ndn:/WDsuBLIMG");
+ auto interest = makeInterest("ndn:/WDsuBLIMG");
pit::Entry entry(*interest);
auto face1 = make_shared<DummyFace>();
@@ -116,7 +116,7 @@
auto face1 = make_shared<DummyFace>();
auto face2 = make_shared<DummyFace>();
- shared_ptr<Interest> interest = makeInterest("ndn:/qtCQ7I1c");
+ auto interest = makeInterest("ndn:/qtCQ7I1c");
interest->setNonce(25559);
pit::Entry entry0(*interest);
@@ -176,9 +176,7 @@
auto face2 = make_shared<DummyFace>();
auto face3 = make_shared<DummyFace>();
- shared_ptr<Interest> interest = makeInterest("ndn:/totzXG0d");
- interest->setNonce(29321);
-
+ auto interest = makeInterest("/totzXG0d", false, nullopt, 29321);
pit::Entry entry(*interest);
BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), false);
@@ -193,7 +191,7 @@
BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), true);
pit::OutRecordCollection::iterator outR = entry.getOutRecord(*face2, 0);
BOOST_REQUIRE(outR != entry.out_end());
- lp::Nack nack = makeNack("ndn:/totzXG0d", 29321, lp::NackReason::DUPLICATE);
+ lp::Nack nack = makeNack(*interest, lp::NackReason::DUPLICATE);
bool isNackAccepted = outR->setIncomingNack(nack); // Nack arrival
BOOST_REQUIRE(isNackAccepted);
BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), false);
@@ -210,7 +208,7 @@
auto face1 = make_shared<DummyFace>();
auto face2 = make_shared<DummyFace>();
- shared_ptr<Interest> interest = makeInterest("ndn:/c1I7QCtc");
+ auto interest = makeInterest("ndn:/c1I7QCtc");
pit::Entry entry(*interest);
time::steady_clock::TimePoint before = time::steady_clock::now();
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index 7325f24..a6d562a 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -44,10 +44,6 @@
{
Forwarder forwarder;
- shared_ptr<Interest> interestAB = makeInterest("/A/B");
- interestAB->setInterestLifetime(4_s);
- shared_ptr<Data> dataABC = makeData("/A/B/C");
-
auto face1 = make_shared<DummyFace>();
auto face2 = make_shared<DummyFace>();
forwarder.addFace(face1);
@@ -60,7 +56,7 @@
BOOST_CHECK_EQUAL(forwarder.getCounters().nOutInterests, 0);
BOOST_CHECK_EQUAL(forwarder.getCounters().nCsHits, 0);
BOOST_CHECK_EQUAL(forwarder.getCounters().nCsMisses, 0);
- face1->receiveInterest(*interestAB, 0);
+ face1->receiveInterest(*makeInterest("/A/B"), 0);
this->advanceClocks(100_ms, 1_s);
BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 1);
BOOST_CHECK_EQUAL(face2->sentInterests[0].getName(), "/A/B");
@@ -73,10 +69,10 @@
BOOST_CHECK_EQUAL(forwarder.getCounters().nInData, 0);
BOOST_CHECK_EQUAL(forwarder.getCounters().nOutData, 0);
- face2->receiveData(*dataABC, 0);
+ face2->receiveData(*makeData("/A/B"), 0);
this->advanceClocks(100_ms, 1_s);
BOOST_REQUIRE_EQUAL(face1->sentData.size(), 1);
- BOOST_CHECK_EQUAL(face1->sentData[0].getName(), "/A/B/C");
+ BOOST_CHECK_EQUAL(face1->sentData[0].getName(), "/A/B");
BOOST_REQUIRE(face1->sentData[0].getTag<lp::IncomingFaceIdTag>() != nullptr);
BOOST_CHECK_EQUAL(*face1->sentData[0].getTag<lp::IncomingFaceIdTag>(), face2->getId());
BOOST_CHECK_EQUAL(forwarder.getCounters().nInData, 1);
@@ -94,23 +90,19 @@
forwarder.addFace(face2);
forwarder.addFace(face3);
- shared_ptr<Interest> interestA = makeInterest("/A");
- interestA->setInterestLifetime(4_s);
- shared_ptr<Data> dataA = makeData("/A");
- dataA->setTag(make_shared<lp::IncomingFaceIdTag>(face3->getId()));
-
Fib& fib = forwarder.getFib();
fib.insert("/A").first->addOrUpdateNextHop(*face2, 0, 0);
Pit& pit = forwarder.getPit();
BOOST_CHECK_EQUAL(pit.size(), 0);
- Cs& cs = forwarder.getCs();
- cs.insert(*dataA);
+ auto data = makeData("/A/B");
+ data->setTag(make_shared<lp::IncomingFaceIdTag>(face3->getId()));
+ forwarder.getCs().insert(*data);
BOOST_CHECK_EQUAL(forwarder.getCounters().nCsHits, 0);
BOOST_CHECK_EQUAL(forwarder.getCounters().nCsMisses, 0);
- face1->receiveInterest(*interestA, 0);
+ face1->receiveInterest(*makeInterest("/A", true), 0);
this->advanceClocks(1_ms, 5_ms);
// Interest matching ContentStore should not be forwarded
BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 0);
@@ -119,6 +111,7 @@
BOOST_REQUIRE_EQUAL(face1->sentData.size(), 1);
// IncomingFaceId field should be reset to represent CS
+ BOOST_CHECK_EQUAL(face1->sentData[0].getName(), "/A/B");
BOOST_REQUIRE(face1->sentData[0].getTag<lp::IncomingFaceIdTag>() != nullptr);
BOOST_CHECK_EQUAL(*face1->sentData[0].getTag<lp::IncomingFaceIdTag>(), face::FACEID_CONTENT_STORE);
@@ -136,13 +129,11 @@
forwarder.addFace(face2);
Pit& pit = forwarder.getPit();
- auto interestA1 = makeInterest("/A");
- interestA1->setNonce(8378);
+ auto interestA1 = makeInterest("/A", false, nullopt, 8378);
shared_ptr<pit::Entry> pitA = pit.insert(*interestA1).first;
pitA->insertOrUpdateInRecord(*face1, 0, *interestA1);
- auto interestA2 = makeInterest("/A");
- interestA2->setNonce(1698);
+ auto interestA2 = makeInterest("/A", false, nullopt, 1698);
forwarder.onOutgoingInterest(pitA, FaceEndpoint(*face2, 0), *interestA2);
pit::OutRecordCollection::iterator outA2 = pitA->getOutRecord(*face2, 0);
@@ -167,7 +158,7 @@
Fib& fib = forwarder.getFib();
fib.insert("/A").first->addOrUpdateNextHop(*face3, 0, 0);
- shared_ptr<Interest> interest = makeInterest("/A/B");
+ auto interest = makeInterest("/A/B");
interest->setTag(make_shared<lp::NextHopFaceIdTag>(face2->getId()));
face1->receiveInterest(*interest, 0);
@@ -208,49 +199,49 @@
// local face, /localhost: OK
forwarder.dispatchToStrategy_count = 0;
- shared_ptr<Interest> i1 = makeInterest("/localhost/A1");
+ auto i1 = makeInterest("/localhost/A1");
forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *i1);
BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 1);
// non-local face, /localhost: violate
forwarder.dispatchToStrategy_count = 0;
- shared_ptr<Interest> i2 = makeInterest("/localhost/A2");
+ auto i2 = makeInterest("/localhost/A2");
forwarder.onIncomingInterest(FaceEndpoint(*face2, 0), *i2);
BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 0);
// local face, non-/localhost: OK
forwarder.dispatchToStrategy_count = 0;
- shared_ptr<Interest> i3 = makeInterest("/A3");
+ auto i3 = makeInterest("/A3");
forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *i3);
BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 1);
// non-local face, non-/localhost: OK
forwarder.dispatchToStrategy_count = 0;
- shared_ptr<Interest> i4 = makeInterest("/A4");
+ auto i4 = makeInterest("/A4");
forwarder.onIncomingInterest(FaceEndpoint(*face2, 0), *i4);
BOOST_CHECK_EQUAL(forwarder.dispatchToStrategy_count, 1);
// local face, /localhost: OK
forwarder.onDataUnsolicited_count = 0;
- shared_ptr<Data> d1 = makeData("/localhost/B1");
+ auto d1 = makeData("/localhost/B1");
forwarder.onIncomingData(FaceEndpoint(*face1, 0), *d1);
BOOST_CHECK_EQUAL(forwarder.onDataUnsolicited_count, 1);
// non-local face, /localhost: OK
forwarder.onDataUnsolicited_count = 0;
- shared_ptr<Data> d2 = makeData("/localhost/B2");
+ auto d2 = makeData("/localhost/B2");
forwarder.onIncomingData(FaceEndpoint(*face2, 0), *d2);
BOOST_CHECK_EQUAL(forwarder.onDataUnsolicited_count, 0);
// local face, non-/localhost: OK
forwarder.onDataUnsolicited_count = 0;
- shared_ptr<Data> d3 = makeData("/B3");
+ auto d3 = makeData("/B3");
forwarder.onIncomingData(FaceEndpoint(*face1, 0), *d3);
BOOST_CHECK_EQUAL(forwarder.onDataUnsolicited_count, 1);
// non-local face, non-/localhost: OK
forwarder.onDataUnsolicited_count = 0;
- shared_ptr<Data> d4 = makeData("/B4");
+ auto d4 = makeData("/B4");
forwarder.onIncomingData(FaceEndpoint(*face2, 0), *d4);
BOOST_CHECK_EQUAL(forwarder.onDataUnsolicited_count, 1);
}
@@ -263,16 +254,16 @@
forwarder.addFace(face1);
forwarder.addFace(face2);
- DummyStrategy& strategyA = choose<DummyStrategy>(forwarder, "ndn:/", DummyStrategy::getStrategyName());
- DummyStrategy& strategyB = choose<DummyStrategy>(forwarder, "ndn:/B", DummyStrategy::getStrategyName());
+ DummyStrategy& strategyA = choose<DummyStrategy>(forwarder, "/", DummyStrategy::getStrategyName());
+ DummyStrategy& strategyB = choose<DummyStrategy>(forwarder, "/B", DummyStrategy::getStrategyName());
- shared_ptr<Interest> interest1 = makeInterest("ndn:/A/1");
+ auto interest1 = makeInterest("/A/1");
strategyA.afterReceiveInterest_count = 0;
strategyA.interestOutFace = face2;
forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest1);
BOOST_CHECK_EQUAL(strategyA.afterReceiveInterest_count, 1);
- shared_ptr<Interest> interest2 = makeInterest("ndn:/B/2");
+ auto interest2 = makeInterest("/B/2", true);
strategyB.afterReceiveInterest_count = 0;
strategyB.interestOutFace = face2;
forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest2);
@@ -280,21 +271,19 @@
this->advanceClocks(1_ms, 5_ms);
- shared_ptr<Data> data1 = makeData("ndn:/A/1/a");
+ auto data1 = makeData("/A/1");
strategyA.beforeSatisfyInterest_count = 0;
forwarder.startProcessData(FaceEndpoint(*face2, 0), *data1);
BOOST_CHECK_EQUAL(strategyA.beforeSatisfyInterest_count, 1);
- shared_ptr<Data> data2 = makeData("ndn:/B/2/b");
+ auto data2 = makeData("/B/2/b");
strategyB.beforeSatisfyInterest_count = 0;
forwarder.startProcessData(FaceEndpoint(*face2, 0), *data2);
BOOST_CHECK_EQUAL(strategyB.beforeSatisfyInterest_count, 1);
- shared_ptr<Interest> interest3 = makeInterest("ndn:/A/3");
- interest3->setInterestLifetime(30_ms);
+ auto interest3 = makeInterest("/A/3", false, 30_ms);
forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest3);
- shared_ptr<Interest> interest4 = makeInterest("ndn:/B/4");
- interest4->setInterestLifetime(5_s);
+ auto interest4 = makeInterest("/B/4", false, 5_s);
forwarder.startProcessInterest(FaceEndpoint(*face1, 0), *interest4);
}
@@ -311,19 +300,19 @@
forwarder.addFace(face4);
Pit& pit = forwarder.getPit();
- shared_ptr<Interest> interest0 = makeInterest("ndn:/");
- shared_ptr<pit::Entry> pit0 = pit.insert(*interest0).first;
- pit0->insertOrUpdateInRecord(*face1, 0, *interest0);
- shared_ptr<Interest> interestA = makeInterest("ndn:/A");
+ auto interestD = makeInterest("/A/B/C/D");
+ shared_ptr<pit::Entry> pitD = pit.insert(*interestD).first;
+ pitD->insertOrUpdateInRecord(*face1, 0, *interestD);
+ auto interestA = makeInterest("/A", true);
shared_ptr<pit::Entry> pitA = pit.insert(*interestA).first;
- pitA->insertOrUpdateInRecord(*face1, 0, *interestA);
pitA->insertOrUpdateInRecord(*face2, 0, *interestA);
- shared_ptr<Interest> interestC = makeInterest("ndn:/A/B/C");
+ pitA->insertOrUpdateInRecord(*face3, 0, *interestA);
+ auto interestC = makeInterest("/A/B/C", true);
shared_ptr<pit::Entry> pitC = pit.insert(*interestC).first;
pitC->insertOrUpdateInRecord(*face3, 0, *interestC);
pitC->insertOrUpdateInRecord(*face4, 0, *interestC);
- shared_ptr<Data> dataD = makeData("ndn:/A/B/C/D");
+ auto dataD = makeData("/A/B/C/D");
forwarder.onIncomingData(FaceEndpoint(*face3, 0), *dataD);
this->advanceClocks(1_ms, 5_ms);
@@ -346,27 +335,27 @@
forwarder.addFace(face2);
forwarder.addFace(face3);
- DummyStrategy& strategyA = choose<DummyStrategy>(forwarder, "ndn:/", DummyStrategy::getStrategyName());
- DummyStrategy& strategyB = choose<DummyStrategy>(forwarder, "ndn:/B", DummyStrategy::getStrategyName());
+ DummyStrategy& strategyA = choose<DummyStrategy>(forwarder, "/", DummyStrategy::getStrategyName());
+ DummyStrategy& strategyB = choose<DummyStrategy>(forwarder, "/B", DummyStrategy::getStrategyName());
Pit& pit = forwarder.getPit();
// dispatch to the correct strategy
- shared_ptr<Interest> interest1 = makeInterest("/A/AYJqayrzF", 562);
+ auto interest1 = makeInterest("/A/AYJqayrzF", false, nullopt, 562);
shared_ptr<pit::Entry> pit1 = pit.insert(*interest1).first;
pit1->insertOrUpdateOutRecord(*face1, 0, *interest1);
- shared_ptr<Interest> interest2 = makeInterest("/B/EVyP73ru", 221);
+ auto interest2 = makeInterest("/B/EVyP73ru", false, nullopt, 221);
shared_ptr<pit::Entry> pit2 = pit.insert(*interest2).first;
pit2->insertOrUpdateOutRecord(*face1, 0, *interest2);
- lp::Nack nack1 = makeNack("/A/AYJqayrzF", 562, lp::NackReason::CONGESTION);
+ lp::Nack nack1 = makeNack(*interest1, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack1);
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 1);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
- lp::Nack nack2 = makeNack("/B/EVyP73ru", 221, lp::NackReason::CONGESTION);
+ lp::Nack nack2 = makeNack(*interest2, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack2);
@@ -380,7 +369,7 @@
BOOST_CHECK_EQUAL(outRecord1->getIncomingNack()->getReason(), lp::NackReason::CONGESTION);
// drop if no PIT entry
- lp::Nack nack3 = makeNack("/yEcw5HhdM", 243, lp::NackReason::CONGESTION);
+ lp::Nack nack3 = makeNack(*makeInterest("/yEcw5HhdM", false, nullopt, 243), lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack3);
@@ -388,11 +377,11 @@
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
// drop if no out-record
- shared_ptr<Interest> interest4 = makeInterest("/Etab4KpY", 157);
+ auto interest4 = makeInterest("/Etab4KpY", false, nullopt, 157);
shared_ptr<pit::Entry> pit4 = pit.insert(*interest4).first;
pit4->insertOrUpdateOutRecord(*face1, 0, *interest4);
- lp::Nack nack4a = makeNack("/Etab4KpY", 157, lp::NackReason::CONGESTION);
+ lp::Nack nack4a = makeNack(*interest4, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
forwarder.onIncomingNack(FaceEndpoint(*face2, 0), nack4a);
@@ -400,7 +389,7 @@
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
// drop if Nonce does not match out-record
- lp::Nack nack4b = makeNack("/Etab4KpY", 294, lp::NackReason::CONGESTION);
+ lp::Nack nack4b = makeNack(*makeInterest("/Etab4KpY", false, nullopt, 294), lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack4b);
@@ -435,7 +424,7 @@
nackHeader.setReason(lp::NackReason::CONGESTION);
// don't send Nack if there's no in-record
- shared_ptr<Interest> interest1 = makeInterest("/fM5IVEtC", 719);
+ auto interest1 = makeInterest("/fM5IVEtC", false, nullopt, 719);
shared_ptr<pit::Entry> pit1 = pit.insert(*interest1).first;
pit1->insertOrUpdateInRecord(*face1, 0, *interest1);
@@ -444,10 +433,10 @@
BOOST_CHECK_EQUAL(face2->sentNacks.size(), 0);
// send Nack with correct Nonce
- shared_ptr<Interest> interest2a = makeInterest("/Vi8tRm9MG3", 152);
+ auto interest2a = makeInterest("/Vi8tRm9MG3", false, nullopt, 152);
shared_ptr<pit::Entry> pit2 = pit.insert(*interest2a).first;
pit2->insertOrUpdateInRecord(*face1, 0, *interest2a);
- shared_ptr<Interest> interest2b = makeInterest("/Vi8tRm9MG3", 808);
+ auto interest2b = makeInterest("/Vi8tRm9MG3", false, nullopt, 808);
pit2->insertOrUpdateInRecord(*face2, 0, *interest2b);
face1->sentNacks.clear();
@@ -472,7 +461,7 @@
BOOST_CHECK(inRecord2b == pit2->in_end());
// don't send Nack to multi-access face
- shared_ptr<Interest> interest2c = makeInterest("/Vi8tRm9MG3", 228);
+ auto interest2c = makeInterest("/Vi8tRm9MG3", false, nullopt, 228);
pit2->insertOrUpdateInRecord(*face3, 0, *interest2c);
face3->sentNacks.clear();
@@ -500,19 +489,19 @@
// receive Interest on face1
face1->sentNacks.clear();
- shared_ptr<Interest> interest1a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732);
+ auto interest1a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, nullopt, 732);
face1->receiveInterest(*interest1a, 0);
BOOST_CHECK(face1->sentNacks.empty());
// receive Interest with duplicate Nonce on face1: legit retransmission
face1->sentNacks.clear();
- shared_ptr<Interest> interest1b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732);
+ auto interest1b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, nullopt, 732);
face1->receiveInterest(*interest1b, 0);
BOOST_CHECK(face1->sentNacks.empty());
// receive Interest with duplicate Nonce on face2
face2->sentNacks.clear();
- shared_ptr<Interest> interest2a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732);
+ 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);
@@ -520,13 +509,13 @@
// receive Interest with new Nonce on face2
face2->sentNacks.clear();
- shared_ptr<Interest> interest2b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 944);
+ auto interest2b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, nullopt, 944);
face2->receiveInterest(*interest2b, 0);
BOOST_CHECK(face2->sentNacks.empty());
// receive Interest with duplicate Nonce on face3, don't send Nack to multi-access face
face3->sentNacks.clear();
- shared_ptr<Interest> interest3a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", 732);
+ auto interest3a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, nullopt, 732);
face3->receiveInterest(*interest3a, 0);
BOOST_CHECK(face3->sentNacks.empty());
}
@@ -551,9 +540,7 @@
fib.insert("/A").first->addOrUpdateNextHop(*face2, 0, 0);
// receive an Interest
- shared_ptr<Interest> interest = makeInterest("ndn:/A/1");
- interest->setNonce(82101183);
- interest->setInterestLifetime(50_ms);
+ auto interest = makeInterest("/A/1", false, 50_ms, 82101183);
face1->receiveInterest(*interest, 0);
// interest should be forwarded only once, as long as Nonce is in Dead Nonce List
@@ -575,9 +562,7 @@
shared_ptr<Face> face1 = make_shared<DummyFace>();
forwarder.addFace(face1);
- shared_ptr<Interest> interest = makeInterest("ndn:/hcLSAsQ9A");
- interest->setNonce(61883075);
- interest->setInterestLifetime(2_s);
+ auto interest = makeInterest("/hcLSAsQ9A", false, 2_s, 61883075);
DeadNonceList& dnl = forwarder.getDeadNonceList();
dnl.add(interest->getName(), interest->getNonce());
diff --git a/tests/daemon/fw/pit-expiry.t.cpp b/tests/daemon/fw/pit-expiry.t.cpp
index 94caac9..bd705c7 100644
--- a/tests/daemon/fw/pit-expiry.t.cpp
+++ b/tests/daemon/fw/pit-expiry.t.cpp
@@ -130,8 +130,8 @@
Pit& pit = forwarder.getPit();
- shared_ptr<Interest> interest1 = makeInterest("/A/0");
- shared_ptr<Interest> interest2 = makeInterest("/A/1");
+ auto interest1 = makeInterest("/A/0");
+ auto interest2 = makeInterest("/A/1");
interest1->setInterestLifetime(90_ms);
interest2->setInterestLifetime(90_ms);
@@ -154,9 +154,9 @@
Pit& pit = forwarder.getPit();
- shared_ptr<Interest> interest = makeInterest("/A/0");
+ auto interest = makeInterest("/A/0");
interest->setInterestLifetime(90_ms);
- shared_ptr<Data> data = makeData("/A/0");
+ auto data = makeData("/A/0");
face1->receiveInterest(*interest, 0);
@@ -180,10 +180,10 @@
PitExpiryTestStrategy::registerAs(strategyA);
choose<PitExpiryTestStrategy>(forwarder, "/A", strategyA);
- shared_ptr<Interest> interest = makeInterest("/A/0");
+ auto interest = makeInterest("/A/0");
interest->setInterestLifetime(90_ms);
- shared_ptr<Data> data = makeData("/A/0");
+ auto data = makeData("/A/0");
data->setTag(make_shared<lp::IncomingFaceIdTag>(face2->getId()));
Pit& pit = forwarder.getPit();
@@ -221,9 +221,8 @@
Pit& pit = forwarder.getPit();
- shared_ptr<Interest> interest = makeInterest("/A/0", 562);
- interest->setInterestLifetime(90_ms);
- lp::Nack nack = makeNack("/A/0", 562, lp::NackReason::CONGESTION);
+ auto interest = makeInterest("/A/0", false, 90_ms, 562);
+ lp::Nack nack = makeNack(*interest, lp::NackReason::CONGESTION);
face1->receiveInterest(*interest, 0);
auto entry = pit.find(*interest);
@@ -253,8 +252,7 @@
Pit& pit = forwarder.getPit();
- shared_ptr<Interest> interest = makeInterest("/A/0");
- interest->setInterestLifetime(90_ms);
+ auto interest = makeInterest("/A/0", false, 90_ms);
face->receiveInterest(*interest, 0);
BOOST_CHECK_EQUAL(pit.size(), 1);
@@ -285,11 +283,9 @@
auto& sB = choose<PitExpiryTestStrategy>(forwarder, "/A/0", strategyB);
Pit& pit = forwarder.getPit();
- shared_ptr<Interest> interest1 = makeInterest("/A");
- shared_ptr<Interest> interest2 = makeInterest("/A/0");
- interest1->setInterestLifetime(90_ms);
- interest2->setInterestLifetime(90_ms);
- shared_ptr<Data> data = makeData("/A/0");
+ auto interest1 = makeInterest("/A", true, 90_ms);
+ auto interest2 = makeInterest("/A/0", false, 90_ms);
+ auto data = makeData("/A/0");
face1->receiveInterest(*interest1, 0);
face2->receiveInterest(*interest2, 0);
@@ -339,9 +335,8 @@
Pit& pit = forwarder.getPit();
- shared_ptr<Interest> interest = makeInterest("/A/0");
- interest->setInterestLifetime(90_ms);
- shared_ptr<Data> data = makeData("/A/0");
+ auto interest = makeInterest("/A/0", false, 90_ms);
+ auto data = makeData("/A/0");
face1->receiveInterest(*interest, 0);
@@ -388,9 +383,8 @@
Pit& pit = forwarder.getPit();
- shared_ptr<Interest> interest = makeInterest("/A/0", 562);
- interest->setInterestLifetime(90_ms);
- lp::Nack nack = makeNack("/A/0", 562, lp::NackReason::CONGESTION);
+ auto interest = makeInterest("/A/0", false, 90_ms, 562);
+ lp::Nack nack = makeNack(*interest, lp::NackReason::CONGESTION);
face1->receiveInterest(*interest, 0);
auto entry = pit.find(*interest);
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index c9a66c2..2494710 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -97,14 +97,14 @@
fibEntry.addOrUpdateNextHop(*this->face4, 0, 20);
fibEntry.addOrUpdateNextHop(*this->face5, 0, 30);
- shared_ptr<Interest> interest1 = makeInterest("/McQYjMbm", 992);
- shared_ptr<Interest> interest2 = makeInterest("/McQYjMbm", 114);
+ auto interest1 = makeInterest("/McQYjMbm", false, nullopt, 992);
+ auto interest2 = makeInterest("/McQYjMbm", false, nullopt, 114);
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest1).first;
pitEntry->insertOrUpdateInRecord(*this->face1, 0, *interest1);
pitEntry->insertOrUpdateInRecord(*this->face2, 0, *interest2);
pitEntry->insertOrUpdateOutRecord(*this->face3, 0, *interest1);
- lp::Nack nack3 = makeNack("/McQYjMbm", 992, lp::NackReason::CONGESTION);
+ lp::Nack nack3 = makeNack(*interest1, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*this->face3, 0)->setIncomingNack(nack3);
BOOST_REQUIRE(this->strategy.waitForAction(
@@ -132,19 +132,19 @@
fibEntry.addOrUpdateNextHop(*this->face4, 0, 20);
fibEntry.addOrUpdateNextHop(*this->face5, 0, 30);
- shared_ptr<Interest> interest1 = makeInterest("/aS9FAyUV19", 286);
+ auto interest1 = makeInterest("/aS9FAyUV19", 286);
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest1).first;
pitEntry->insertOrUpdateInRecord(*this->face1, 0, *interest1);
pitEntry->insertOrUpdateOutRecord(*this->face3, 0, *interest1);
pitEntry->insertOrUpdateOutRecord(*this->face4, 0, *interest1);
- lp::Nack nack3 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION);
+ lp::Nack nack3 = makeNack(*interest1, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*this->face3, 0)->setIncomingNack(nack3);
this->strategy.afterReceiveNack(FaceEndpoint(*this->face3, 0), nack3, pitEntry);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0); // don't send Nack until all upstreams have Nacked
- lp::Nack nack4 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION);
+ 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); },
@@ -165,20 +165,19 @@
fibEntry.addOrUpdateNextHop(*this->face4, 0, 20);
fibEntry.addOrUpdateNextHop(*this->face5, 0, 30);
- shared_ptr<Interest> interest1 = makeInterest("/sIYw0TXWDj", 115);
- interest1->setInterestLifetime(400_ms);
+ auto interest1 = makeInterest("/sIYw0TXWDj", false, 400_ms, 115);
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest1).first;
pitEntry->insertOrUpdateInRecord(*this->face1, 0, *interest1);
pitEntry->insertOrUpdateOutRecord(*this->face3, 0, *interest1);
this->advanceClocks(300_ms);
- shared_ptr<Interest> interest2 = makeInterest("/sIYw0TXWDj", 223);
+ auto interest2 = makeInterest("/sIYw0TXWDj", false, nullopt, 223);
pitEntry->insertOrUpdateInRecord(*this->face1, 0, *interest2);
pitEntry->insertOrUpdateOutRecord(*this->face4, 0, *interest2);
this->advanceClocks(200_ms); // face3 has timed out
- lp::Nack nack4 = makeNack("/sIYw0TXWDj", 223, lp::NackReason::CONGESTION);
+ lp::Nack nack4 = makeNack(*interest2, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*this->face4, 0)->setIncomingNack(nack4);
this->strategy.afterReceiveNack(FaceEndpoint(*this->face4, 0), nack4, pitEntry);
@@ -255,11 +254,11 @@
ndn::Face& appD = topo.addAppFace("D", nodeD)->getClientFace();
int nNacksA = 0, nNacksD = 0;
- appA.expressInterest(Interest("/P/1"), nullptr, bind([&nNacksA] { ++nNacksA; }), nullptr);
- appD.expressInterest(Interest("/P/1"), nullptr, bind([&nNacksD] { ++nNacksD; }), nullptr);
+ appA.expressInterest(*makeInterest("/P/1"), nullptr, bind([&nNacksA] { ++nNacksA; }), nullptr);
+ appD.expressInterest(*makeInterest("/P/1"), nullptr, bind([&nNacksD] { ++nNacksD; }), nullptr);
this->advanceClocks(1_ms, 5_ms);
- appA.expressInterest(Interest("/P/1"), nullptr, bind([&nNacksA] { ++nNacksA; }), nullptr);
- appD.expressInterest(Interest("/P/1"), nullptr, bind([&nNacksD] { ++nNacksD; }), nullptr);
+ appA.expressInterest(*makeInterest("/P/1"), nullptr, bind([&nNacksA] { ++nNacksA; }), nullptr);
+ appD.expressInterest(*makeInterest("/P/1"), nullptr, bind([&nNacksD] { ++nNacksD; }), nullptr);
this->advanceClocks(1_ms, 100_ms);
// As long as at least one Nack arrives at each client, strategy behavior is correct.
@@ -318,7 +317,7 @@
fibEntry.addOrUpdateNextHop(*face4, 0, 20);
fibEntry.addOrUpdateNextHop(*face5, 0, 30);
- shared_ptr<Interest> interest1 = makeInterest("/F6sEwB24I", 282);
+ auto interest1 = makeInterest("/F6sEwB24I", false, nullopt, 282);
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
pitEntry->insertOrUpdateInRecord(*face1, 0, *interest1);
pitEntry->insertOrUpdateOutRecord(*face3, 0, *interest1);
diff --git a/tests/daemon/fw/strategy-scope-control.t.cpp b/tests/daemon/fw/strategy-scope-control.t.cpp
index 4b83e46..0214152 100644
--- a/tests/daemon/fw/strategy-scope-control.t.cpp
+++ b/tests/daemon/fw/strategy-scope-control.t.cpp
@@ -118,7 +118,7 @@
fib::Entry* fibEntry = this->fib.insert("/localhost/A").first;
fibEntry->addOrUpdateNextHop(*this->localFace4, 0, 10);
- shared_ptr<Interest> interest = makeInterest("/localhost/A/1");
+ auto interest = makeInterest("/localhost/A/1");
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest);
@@ -137,7 +137,7 @@
fib::Entry* fibEntry = this->fib.insert("/localhost/A").first;
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 0, 10);
- shared_ptr<Interest> interest = makeInterest("/localhost/A/1");
+ auto interest = makeInterest("/localhost/A/1");
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest);
@@ -160,7 +160,7 @@
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 0, 10);
fibEntry->addOrUpdateNextHop(*this->localFace4, 0, 20);
- shared_ptr<Interest> interest = makeInterest("/localhost/A/1");
+ auto interest = makeInterest("/localhost/A/1");
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest);
@@ -180,7 +180,7 @@
fib::Entry* fibEntry = this->fib.insert("/localhop/A").first;
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 0, 10);
- shared_ptr<Interest> interest = makeInterest("/localhop/A/1");
+ auto interest = makeInterest("/localhop/A/1");
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, 0, *interest);
@@ -203,7 +203,7 @@
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 0, 10);
fibEntry->addOrUpdateNextHop(*this->localFace4, 0, 20);
- shared_ptr<Interest> interest = makeInterest("/localhop/A/1");
+ auto interest = makeInterest("/localhop/A/1");
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, 0, *interest);
@@ -224,10 +224,10 @@
fibEntry->addOrUpdateNextHop(*this->localFace4, 0, 10);
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 0, 20);
- shared_ptr<Interest> interest = makeInterest("/localhost/A/1", 1460);
+ auto interest = makeInterest("/localhost/A/1", false, nullopt, 1460);
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest);
- lp::Nack nack = makeNack("/localhost/A/1", 1460, lp::NackReason::NO_ROUTE);
+ lp::Nack nack = makeNack(*interest, lp::NackReason::NO_ROUTE);
pitEntry->insertOrUpdateOutRecord(*this->localFace4, 0, *interest)->setIncomingNack(nack);
BOOST_REQUIRE(this->strategy.waitForAction(
@@ -249,10 +249,10 @@
fibEntry->addOrUpdateNextHop(*this->localFace4, 0, 10);
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 0, 20);
- shared_ptr<Interest> interest = makeInterest("/localhop/A/1", 1377);
+ auto interest = makeInterest("/localhop/A/1", 1377);
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, 0, *interest);
- lp::Nack nack = makeNack("/localhop/A/1", 1377, lp::NackReason::NO_ROUTE);
+ lp::Nack nack = makeNack(*interest, lp::NackReason::NO_ROUTE);
pitEntry->insertOrUpdateOutRecord(*this->localFace4, 0, *interest)->setIncomingNack(nack);
BOOST_REQUIRE(this->strategy.waitForAction(
diff --git a/tests/daemon/mgmt/cs-manager.t.cpp b/tests/daemon/mgmt/cs-manager.t.cpp
index 50c82b9..3f6b3aa 100644
--- a/tests/daemon/mgmt/cs-manager.t.cpp
+++ b/tests/daemon/mgmt/cs-manager.t.cpp
@@ -209,7 +209,7 @@
m_fwCnt.nCsHits.set(362);
m_fwCnt.nCsMisses.set(1493);
- receiveInterest(Interest("/localhost/nfd/cs/info").setCanBePrefix(true));
+ receiveInterest(*makeInterest("/localhost/nfd/cs/info", true));
Block dataset = concatenateResponses();
dataset.parse();
BOOST_REQUIRE_EQUAL(dataset.elements_size(), 1);
diff --git a/tests/daemon/mgmt/manager-base.t.cpp b/tests/daemon/mgmt/manager-base.t.cpp
index 0dace4e..c253bb8 100644
--- a/tests/daemon/mgmt/manager-base.t.cpp
+++ b/tests/daemon/mgmt/manager-base.t.cpp
@@ -114,7 +114,7 @@
m_manager.registerStatusDatasetHandler("test-status", handler);
setTopPrefix();
- receiveInterest(Interest("/localhost/nfd/test-module/test-status"));
+ receiveInterest(*makeInterest("/localhost/nfd/test-module/test-status", true));
BOOST_CHECK(isStatusDatasetCalled);
}
diff --git a/tests/daemon/mgmt/manager-common-fixture.cpp b/tests/daemon/mgmt/manager-common-fixture.cpp
index ed4344e..ebead64 100644
--- a/tests/daemon/mgmt/manager-common-fixture.cpp
+++ b/tests/daemon/mgmt/manager-common-fixture.cpp
@@ -148,7 +148,7 @@
Name prefix = name.getPrefix(-1);
uint64_t segmentNo = name.at(-1).toSegment() + 1;
// request for the next segment
- receiveInterest(Interest(prefix.appendSegment(segmentNo)));
+ receiveInterest(*makeInterest(prefix.appendSegment(segmentNo)));
}
size_t endIndex = startIndex + nResponses; // not included
diff --git a/tests/daemon/mgmt/rib-manager.t.cpp b/tests/daemon/mgmt/rib-manager.t.cpp
index dd34b5e..70369a7 100644
--- a/tests/daemon/mgmt/rib-manager.t.cpp
+++ b/tests/daemon/mgmt/rib-manager.t.cpp
@@ -445,7 +445,7 @@
}
}
- receiveInterest(Interest("/localhost/nfd/rib/list"));
+ receiveInterest(*makeInterest("/localhost/nfd/rib/list", true));
Block content = concatenateResponses();
content.parse();
diff --git a/tests/daemon/table/pit.t.cpp b/tests/daemon/table/pit.t.cpp
index 5b051fb..d5d77e9 100644
--- a/tests/daemon/table/pit.t.cpp
+++ b/tests/daemon/table/pit.t.cpp
@@ -42,8 +42,8 @@
BOOST_AUTO_TEST_CASE(Find)
{
- shared_ptr<Interest> interest1 = makeInterest("/6hNwxJjw");
- shared_ptr<Interest> interest2 = makeInterest("/v65zqxm4d");
+ auto interest1 = makeInterest("/6hNwxJjw");
+ auto interest2 = makeInterest("/v65zqxm4d");
NameTree nameTree(16);
Pit pit(nameTree);
@@ -76,89 +76,89 @@
std::pair<shared_ptr<Entry>, bool> insertResult;
// base
- shared_ptr<Interest> interestA = make_shared<Interest>(name1);
+ auto interestA = make_shared<Interest>(name1);
insertResult = pit.insert(*interestA);
BOOST_CHECK_EQUAL(insertResult.second, true);
BOOST_CHECK_EQUAL(pit.size(), 1);
// same as A
- shared_ptr<Interest> interestA2 = make_shared<Interest>(*interestA);
+ auto interestA2 = make_shared<Interest>(*interestA);
insertResult = pit.insert(*interestA2);
BOOST_CHECK_EQUAL(insertResult.second, false); // sharing the same PIT entry
BOOST_CHECK_EQUAL(pit.size(), 1);
// A+MinSuffixComponents
- shared_ptr<Interest> interestB = make_shared<Interest>(*interestA);
+ auto interestB = make_shared<Interest>(*interestA);
interestB->setMinSuffixComponents(2);
insertResult = pit.insert(*interestB);
BOOST_CHECK_EQUAL(insertResult.second, true);
BOOST_CHECK_EQUAL(pit.size(), 2);
// A+MaxSuffixComponents
- shared_ptr<Interest> interestC = make_shared<Interest>(*interestA);
+ auto interestC = make_shared<Interest>(*interestA);
interestC->setMaxSuffixComponents(4);
insertResult = pit.insert(*interestC);
BOOST_CHECK_EQUAL(insertResult.second, true);
BOOST_CHECK_EQUAL(pit.size(), 3);
// A+KeyLocator1
- shared_ptr<Interest> interestD = make_shared<Interest>(*interestA);
+ auto interestD = make_shared<Interest>(*interestA);
interestD->setPublisherPublicKeyLocator(keyLocator1);
insertResult = pit.insert(*interestD);
BOOST_CHECK_EQUAL(insertResult.second, true);
BOOST_CHECK_EQUAL(pit.size(), 4);
// A+KeyLocator2
- shared_ptr<Interest> interestE = make_shared<Interest>(*interestA);
+ auto interestE = make_shared<Interest>(*interestA);
interestE->setPublisherPublicKeyLocator(keyLocator2);
insertResult = pit.insert(*interestE);
BOOST_CHECK_EQUAL(insertResult.second, true);
BOOST_CHECK_EQUAL(pit.size(), 5);
// A+Exclude1
- shared_ptr<Interest> interestF = make_shared<Interest>(*interestA);
+ auto interestF = make_shared<Interest>(*interestA);
interestF->setExclude(exclude1);
insertResult = pit.insert(*interestF);
BOOST_CHECK_EQUAL(insertResult.second, true);
BOOST_CHECK_EQUAL(pit.size(), 6);
// A+Exclude2
- shared_ptr<Interest> interestG = make_shared<Interest>(*interestA);
+ auto interestG = make_shared<Interest>(*interestA);
interestG->setExclude(exclude2);
insertResult = pit.insert(*interestG);
BOOST_CHECK_EQUAL(insertResult.second, true);
BOOST_CHECK_EQUAL(pit.size(), 7);
// A+ChildSelector1
- shared_ptr<Interest> interestI = make_shared<Interest>(*interestA);
+ auto interestI = make_shared<Interest>(*interestA);
interestI->setChildSelector(1);
insertResult = pit.insert(*interestI);
BOOST_CHECK_EQUAL(insertResult.second, true);
BOOST_CHECK_EQUAL(pit.size(), 8);
// A+MustBeFresh
- shared_ptr<Interest> interestJ = make_shared<Interest>(*interestA);
+ auto interestJ = make_shared<Interest>(*interestA);
interestJ->setMustBeFresh(true);
insertResult = pit.insert(*interestJ);
BOOST_CHECK_EQUAL(insertResult.second, true);
BOOST_CHECK_EQUAL(pit.size(), 9);
// A+InterestLifetime
- shared_ptr<Interest> interestK = make_shared<Interest>(*interestA);
+ auto interestK = make_shared<Interest>(*interestA);
interestK->setInterestLifetime(1_s);
insertResult = pit.insert(*interestK);
BOOST_CHECK_EQUAL(insertResult.second, false); // only guiders differ
BOOST_CHECK_EQUAL(pit.size(), 9);
// A+Nonce
- shared_ptr<Interest> interestL = make_shared<Interest>(*interestA);
+ auto interestL = make_shared<Interest>(*interestA);
interestL->setNonce(2192);
insertResult = pit.insert(*interestL);
BOOST_CHECK_EQUAL(insertResult.second, false); // only guiders differ
BOOST_CHECK_EQUAL(pit.size(), 9);
// different Name+Exclude1
- shared_ptr<Interest> interestM = make_shared<Interest>(name2);
+ auto interestM = make_shared<Interest>(name2);
interestM->setExclude(exclude1);
insertResult = pit.insert(*interestM);
BOOST_CHECK_EQUAL(insertResult.second, true);
@@ -167,7 +167,7 @@
BOOST_AUTO_TEST_CASE(Erase)
{
- shared_ptr<Interest> interest = makeInterest("/z88Admz6A2");
+ auto interest = makeInterest("/z88Admz6A2");
NameTree nameTree(16);
Pit pit(nameTree);
@@ -202,7 +202,7 @@
Pit pit(nameTree);
size_t nNameTreeEntriesBefore = nameTree.size();
- shared_ptr<Interest> interest = makeInterest("/37xWVvQ2K");
+ auto interest = makeInterest("/37xWVvQ2K");
shared_ptr<Entry> entry = pit.insert(*interest).first;
pit.erase(entry.get());
BOOST_CHECK_EQUAL(nameTree.size(), nNameTreeEntriesBefore);
@@ -210,8 +210,8 @@
BOOST_AUTO_TEST_CASE(EraseWithFullName)
{
- shared_ptr<Data> data = makeData("/test");
- shared_ptr<Interest> interest = makeInterest(data->getFullName());
+ auto data = makeData("/test");
+ auto interest = makeInterest(data->getFullName());
NameTree nameTree(16);
Pit pit(nameTree);
@@ -244,9 +244,9 @@
Name nameABCD("ndn:/A/B/C/D");
Name nameD ("ndn:/D");
- shared_ptr<Interest> interestA = makeInterest(nameA );
- shared_ptr<Interest> interestABC = makeInterest(nameABC);
- shared_ptr<Interest> interestD = makeInterest(nameD );
+ auto interestA = makeInterest(nameA, true);
+ auto interestABC = makeInterest(nameABC, true);
+ auto interestD = makeInterest(nameD, true);
NameTree nameTree(16);
Pit pit(nameTree);
@@ -262,7 +262,7 @@
BOOST_CHECK_EQUAL(pit.size(), 3);
- shared_ptr<Data> data = makeData(nameABCD);
+ auto data = makeData(nameABCD);
DataMatchResult matches = pit.findAllDataMatches(*data);
@@ -299,9 +299,9 @@
NameTree nameTree(16);
Pit pit(nameTree);
- shared_ptr<Data> data = makeData("/A");
+ auto data = makeData("/A");
Name fullName = data->getFullName();
- shared_ptr<Interest> interest = makeInterest(fullName);
+ auto interest = makeInterest(fullName);
pit.insert(*interest);
DataMatchResult matches = pit.findAllDataMatches(*data);
@@ -354,11 +354,11 @@
NameTree nameTree(16);
Pit pit(nameTree);
- shared_ptr<Interest> interestA = makeInterest("/A");
- shared_ptr<Interest> interestABC1 = makeInterest("/A/B/C");
- shared_ptr<Interest> interestABC2 = makeInterest("/A/B/C");
+ auto interestA = makeInterest("/A");
+ auto interestABC1 = makeInterest("/A/B/C");
+ auto interestABC2 = makeInterest("/A/B/C");
interestABC2->setSelectors(ndn::Selectors().setMinSuffixComponents(10));
- shared_ptr<Interest> interestD = makeInterest("/D");
+ auto interestD = makeInterest("/D");
BOOST_CHECK_EQUAL(pit.size(), 0);
BOOST_CHECK(pit.begin() == pit.end());
diff --git a/tests/test-common.cpp b/tests/test-common.cpp
index 534d961..9bc824a 100644
--- a/tests/test-common.cpp
+++ b/tests/test-common.cpp
@@ -31,11 +31,16 @@
namespace tests {
shared_ptr<Interest>
-makeInterest(const Name& name, uint32_t nonce)
+makeInterest(const Name& name, bool canBePrefix, optional<time::milliseconds> lifetime,
+ optional<uint32_t> nonce)
{
auto interest = make_shared<Interest>(name);
- if (nonce != 0) {
- interest->setNonce(nonce);
+ interest->setCanBePrefix(canBePrefix);
+ if (lifetime) {
+ interest->setInterestLifetime(*lifetime);
+ }
+ if (nonce) {
+ interest->setNonce(*nonce);
}
return interest;
}
@@ -66,14 +71,6 @@
return nack;
}
-lp::Nack
-makeNack(const Name& name, uint32_t nonce, lp::NackReason reason)
-{
- Interest interest(name);
- interest.setNonce(nonce);
- return makeNack(std::move(interest), reason);
-}
-
ndn::PrefixAnnouncement
makePrefixAnn(const Name& announcedName, time::milliseconds expiration,
optional<ndn::security::ValidityPeriod> validity)
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 63b1a99..e123b5e 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -48,12 +48,11 @@
namespace tests {
/** \brief create an Interest
- * \param name Interest name
- * \param nonce if non-zero, set Nonce to this value
- * (useful for creating Nack with same Nonce)
*/
shared_ptr<Interest>
-makeInterest(const Name& name, uint32_t nonce = 0);
+makeInterest(const Name& name, bool canBePrefix = false,
+ optional<time::milliseconds> lifetime = nullopt,
+ optional<uint32_t> nonce = nullopt);
/** \brief create a Data with fake signature
* \note Data may be modified afterwards without losing the fake signature.
@@ -83,14 +82,6 @@
lp::Nack
makeNack(Interest interest, lp::NackReason reason);
-/** \brief create a Nack
- * \param name Interest name
- * \param nonce Interest nonce
- * \param reason Nack reason
- */
-lp::Nack
-makeNack(const Name& name, uint32_t nonce, lp::NackReason reason);
-
/** \brief replace a name component
* \param[inout] name name
* \param index name component index