chunks: show correct packet loss stats in AIMD pipeline output
Besides, AIMD pipeline prints a proper message when no RTT
measurements are available.
Change-Id: I9cbda88a005ba33cba753468f8f60f0d39281ab7
refs: #4437, #4551
diff --git a/tests/chunks/pipeline-interests-aimd.t.cpp b/tests/chunks/pipeline-interests-aimd.t.cpp
index 98ba9ea..2deed18 100644
--- a/tests/chunks/pipeline-interests-aimd.t.cpp
+++ b/tests/chunks/pipeline-interests-aimd.t.cpp
@@ -472,6 +472,30 @@
BOOST_CHECK_EQUAL(hasFailed, false);
}
+BOOST_AUTO_TEST_CASE(PrintSummaryWithNoRttMeasurements)
+{
+ // test the console ouptut when no RTT measurement is available,
+ // to make sure a proper message will be printed out
+
+ std::stringstream ss;
+
+ // change the underlying buffer and save the old buffer
+ auto oldBuf = std::cerr.rdbuf(ss.rdbuf());
+
+ aimdPipeline->printSummary();
+ std::string line;
+
+ bool found = false;
+ while (std::getline(ss, line)) {
+ if (line == "RTT stats unavailable") {
+ found = true;
+ break;
+ }
+ }
+ BOOST_CHECK(found);
+ std::cerr.rdbuf(oldBuf); // reset
+}
+
BOOST_AUTO_TEST_SUITE_END() // TestPipelineInterestsAimd
BOOST_AUTO_TEST_SUITE_END() // Chunks