fw: add test for received Interest with no nonce
refs #4685
Change-Id: I4f81890b34f4453825f7426e5e55c58b234258cd
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index 5f2518e..e1b7bd8 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -135,6 +135,25 @@
BOOST_CHECK_EQUAL(pit.size(), 0);
}
+BOOST_AUTO_TEST_CASE(InterestWithoutNonce)
+{
+ auto face1 = addFace();
+ auto face2 = addFace();
+
+ Fib& fib = forwarder.getFib();
+ fib::Entry* entry = fib.insert("/A").first;
+ fib.addOrUpdateNextHop(*entry, *face2, 0);
+
+ auto interest = makeInterest("/A");
+ BOOST_CHECK_EQUAL(interest->hasNonce(), false);
+ face1->receiveInterest(*interest, 0);
+
+ // Ensure Nonce added if incoming packet did not have Nonce
+ BOOST_REQUIRE_EQUAL(face2->getCounters().nOutInterests, 1);
+ BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 1);
+ BOOST_CHECK_EQUAL(face2->sentInterests.back().hasNonce(), true);
+}
+
BOOST_AUTO_TEST_CASE(OutgoingInterest)
{
auto face1 = addFace();