catchunks: pass versioned name to onDiscoverySuccess signal
refs: #4556
Change-Id: I599bafcf70647bd806236f87f24d7a22f73a3505
diff --git a/tests/chunks/pipeline-interests-fixed-window.t.cpp b/tests/chunks/pipeline-interests-fixed-window.t.cpp
index c4d4aad..e75b4a2 100644
--- a/tests/chunks/pipeline-interests-fixed-window.t.cpp
+++ b/tests/chunks/pipeline-interests-fixed-window.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2018, Regents of the University of California,
+ * Copyright (c) 2016-2019, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -21,6 +21,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*
* @author Andrea Tosatto
+ * @author Chavoosh Ghasemi
*/
#include "tools/chunks/catchunks/pipeline-interests-fixed-window.hpp"
@@ -61,53 +62,23 @@
BOOST_AUTO_TEST_SUITE(Chunks)
BOOST_FIXTURE_TEST_SUITE(TestPipelineInterestsFixedWindow, PipelineInterestFixedWindowFixture)
-BOOST_AUTO_TEST_CASE(FewerSegmentsThanPipelineCapacity)
-{
- nDataSegments = 3;
- BOOST_ASSERT(nDataSegments <= opt.maxPipelineSize);
-
- runWithData(*makeDataWithSegment(0));
- advanceClocks(io, time::nanoseconds(1), 1);
- BOOST_REQUIRE_EQUAL(face.sentInterests.size(), nDataSegments - 1);
-
- for (uint64_t i = 1; i < nDataSegments - 1; ++i) {
- face.receive(*makeDataWithSegment(i));
- advanceClocks(io, time::nanoseconds(1), 1);
-
- BOOST_CHECK_EQUAL(pipeline->m_nReceived, i + 1);
- BOOST_REQUIRE_EQUAL(face.sentInterests.size(), nDataSegments - 1);
- // check if the interest for the segment i+1 is well formed
- const auto& sentInterest = face.sentInterests[i];
- BOOST_CHECK_EQUAL(sentInterest.getExclude().size(), 0);
- BOOST_CHECK_EQUAL(sentInterest.getMaxSuffixComponents(), 1);
- BOOST_CHECK_EQUAL(sentInterest.getMustBeFresh(), opt.mustBeFresh);
- BOOST_CHECK_EQUAL(Name(name).isPrefixOf(sentInterest.getName()), true);
- BOOST_CHECK_EQUAL(getSegmentFromPacket(sentInterest), i + 1);
- }
-
- BOOST_CHECK_EQUAL(hasFailed, false);
-
- advanceClocks(io, ndn::DEFAULT_INTEREST_LIFETIME, opt.maxRetriesOnTimeoutOrNack + 1);
- BOOST_CHECK_EQUAL(hasFailed, true);
-}
-
BOOST_AUTO_TEST_CASE(FullPipeline)
{
nDataSegments = 13;
BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
- runWithData(*makeDataWithSegment(nDataSegments - 1));
+ run(name);
advanceClocks(io, time::nanoseconds(1), 1);
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
for (uint64_t i = 0; i < nDataSegments - 1; ++i) {
face.receive(*makeDataWithSegment(i));
advanceClocks(io, time::nanoseconds(1), 1);
- BOOST_CHECK_EQUAL(pipeline->m_nReceived, i + 2);
+ BOOST_CHECK_EQUAL(pipeline->m_nReceived, i + 1);
- if (i < nDataSegments - opt.maxPipelineSize - 1) {
+ if (i < nDataSegments - opt.maxPipelineSize) {
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize + i + 1);
- // check if the interest for the segment i+1 is well formed
+ // check if the interest for the segment i is well formed
const auto& sentInterest = face.sentInterests[i];
BOOST_CHECK_EQUAL(sentInterest.getExclude().size(), 0);
BOOST_CHECK_EQUAL(sentInterest.getMaxSuffixComponents(), 1);
@@ -117,11 +88,14 @@
}
else {
// all the interests have been sent for all the segments
- BOOST_CHECK_EQUAL(face.sentInterests.size(), nDataSegments - 1);
+ BOOST_CHECK_EQUAL(face.sentInterests.size(), nDataSegments);
}
}
BOOST_CHECK_EQUAL(hasFailed, false);
+
+ advanceClocks(io, ndn::DEFAULT_INTEREST_LIFETIME, opt.maxRetriesOnTimeoutOrNack + 1);
+ BOOST_CHECK_EQUAL(hasFailed, true);
}
BOOST_AUTO_TEST_CASE(TimeoutAllSegments)
@@ -129,14 +103,14 @@
nDataSegments = 13;
BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
- runWithData(*makeDataWithSegment(nDataSegments - 1));
+ run(name);
advanceClocks(io, time::nanoseconds(1), 1);
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
for (int i = 0; i < opt.maxRetriesOnTimeoutOrNack; ++i) {
advanceClocks(io, opt.interestLifetime, 1);
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize * (i + 2));
- BOOST_CHECK_EQUAL(pipeline->m_nReceived, 1);
+ BOOST_CHECK_EQUAL(pipeline->m_nReceived, 0);
// A single retry for every pipeline element
for (size_t j = 0; j < opt.maxPipelineSize; ++j) {
@@ -157,7 +131,7 @@
nDataSegments = 18;
BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
- runWithData(*makeDataWithSegment(nDataSegments - 1));
+ run(name);
advanceClocks(io, time::nanoseconds(1), 1);
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
@@ -170,7 +144,7 @@
// send a single data packet for each pipeline element
advanceClocks(io, opt.interestLifetime, opt.maxRetriesOnTimeoutOrNack - 1);
- for (uint64_t i = 0; i < opt.maxPipelineSize - 1; ++i) {
+ for (uint64_t i = 0; i < opt.maxPipelineSize; ++i) {
face.receive(*makeDataWithSegment(opt.maxPipelineSize + i));
advanceClocks(io, time::nanoseconds(1), 1);
}
@@ -183,7 +157,7 @@
// these new segments should not generate new interests
advanceClocks(io, opt.interestLifetime, 1);
- for (uint64_t i = 0; i < opt.maxPipelineSize - 1; ++i) {
+ for (uint64_t i = 0; i < opt.maxPipelineSize; ++i) {
face.receive(*makeDataWithSegment(opt.maxPipelineSize * 2 + i - 1));
advanceClocks(io, time::nanoseconds(1), 1);
}
@@ -202,7 +176,7 @@
nDataSegments = 22;
BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
- runWithData(*makeDataWithSegment(nDataSegments - 1, false));
+ run(name);
advanceClocks(io, time::nanoseconds(1), 1);
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
@@ -231,8 +205,8 @@
BOOST_CHECK_EQUAL(hasFailed, false);
// data for all the pipeline element, but not the second (segment #1)
- for (uint64_t i = opt.maxPipelineSize; i < nDataSegments - 1; ++i) {
- if (i == nDataSegments - 2) {
+ for (uint64_t i = opt.maxPipelineSize; i < nDataSegments; ++i) {
+ if (i == nDataSegments - 1) {
face.receive(*makeDataWithSegment(i, true));
}
else {
@@ -255,7 +229,7 @@
nDataSegments = 22;
BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
- runWithData(*makeDataWithSegment(nDataSegments - 1, false));
+ run(name);
advanceClocks(io, time::nanoseconds(1), 1);
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
@@ -272,11 +246,11 @@
BOOST_CHECK_EQUAL(hasFailed, false);
// data for the first pipeline element (segment #0), this should trigger an error because the
- // others pipeline elements failed
+ // other pipeline elements failed
face.receive(*makeDataWithSegment(0, false));
advanceClocks(io, time::nanoseconds(1), 1);
- BOOST_CHECK_EQUAL(pipeline->m_nReceived, 2);
+ BOOST_CHECK_EQUAL(pipeline->m_nReceived, 1);
BOOST_CHECK_EQUAL(hasFailed, true);
}
@@ -285,13 +259,13 @@
nDataSegments = 13;
BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
- runWithData(*makeDataWithSegment(nDataSegments - 1));
+ run(name);
advanceClocks(io, time::nanoseconds(1), 1);
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
// send nack for all the pipeline elements first interest
- for (size_t j = 0; j < opt.maxPipelineSize; j++) {
- auto nack = make_shared<lp::Nack>(face.sentInterests[j]);
+ for (size_t i = 0; i < opt.maxPipelineSize; i++) {
+ auto nack = make_shared<lp::Nack>(face.sentInterests[i]);
nack->setReason(lp::NackReason::CONGESTION);
face.receive(*nack);
advanceClocks(io, time::nanoseconds(1), 1);