fw: increment nOutNacks when sending a Nack from onInterestLoop

Also expand test coverage of all forwarder counters

Change-Id: I6948af05aca1b5589e2f1c8a1f23c002d39d0ec0
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index 6fbb688..0d27c4b 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2023,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -51,6 +51,7 @@
 protected:
   FaceTable faceTable;
   Forwarder forwarder{faceTable};
+  const ForwarderCounters& counters{forwarder.getCounters()};
 };
 
 BOOST_AUTO_TEST_SUITE(Fw)
@@ -65,39 +66,53 @@
   fib::Entry* entry = fib.insert("/A").first;
   fib.addOrUpdateNextHop(*entry, *face2, 0);
 
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nInInterests, 0);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nOutInterests, 0);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nCsHits, 0);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nCsMisses, 0);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nInData, 0);
+  BOOST_CHECK_EQUAL(counters.nOutData, 0);
+  BOOST_CHECK_EQUAL(counters.nInNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nSatisfiedInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nUnsatisfiedInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nUnsolicitedData, 0);
+  BOOST_CHECK_EQUAL(counters.nCsHits, 0);
+  BOOST_CHECK_EQUAL(counters.nCsMisses, 0);
+
   face1->receiveInterest(*makeInterest("/A/B"));
   this->advanceClocks(100_ms, 1_s);
   BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 1);
   BOOST_CHECK_EQUAL(face2->sentInterests[0].getName(), "/A/B");
   BOOST_REQUIRE(face2->sentInterests[0].getTag<lp::IncomingFaceIdTag>() != nullptr);
   BOOST_CHECK_EQUAL(*face2->sentInterests[0].getTag<lp::IncomingFaceIdTag>(), face1->getId());
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nInInterests, 1);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nOutInterests, 1);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nCsHits, 0);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nCsMisses, 1);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nSatisfiedInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nInData, 0);
+  BOOST_CHECK_EQUAL(counters.nOutData, 0);
+  BOOST_CHECK_EQUAL(counters.nSatisfiedInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nUnsatisfiedInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nCsHits, 0);
+  BOOST_CHECK_EQUAL(counters.nCsMisses, 1);
 
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nInData, 0);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nOutData, 0);
   face2->receiveData(*makeData("/A/B"));
   this->advanceClocks(100_ms, 1_s);
   BOOST_REQUIRE_EQUAL(face1->sentData.size(), 1);
   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);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nOutData, 1);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nInNacks, 0);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nOutNacks, 0);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nSatisfiedInterests, 1);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 0);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nInData, 1);
+  BOOST_CHECK_EQUAL(counters.nOutData, 1);
+  BOOST_CHECK_EQUAL(counters.nInNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nSatisfiedInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nUnsatisfiedInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nUnsolicitedData, 0);
+  BOOST_CHECK_EQUAL(counters.nCsHits, 0);
+  BOOST_CHECK_EQUAL(counters.nCsMisses, 1);
 }
 
-BOOST_AUTO_TEST_CASE(CsMatched)
+BOOST_AUTO_TEST_CASE(CsHit)
 {
   auto face1 = addFace();
   auto face2 = addFace();
@@ -114,24 +129,35 @@
   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);
+  BOOST_CHECK_EQUAL(counters.nCsHits, 0);
+  BOOST_CHECK_EQUAL(counters.nCsMisses, 0);
+
   face1->receiveInterest(*makeInterest("/A", true));
   this->advanceClocks(1_ms, 5_ms);
   // Interest matching ContentStore should not be forwarded
-  BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 0);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nCsHits, 1);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nCsMisses, 0);
+  BOOST_CHECK_EQUAL(face2->sentInterests.size(), 0);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nInNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nCsHits, 1);
+  BOOST_CHECK_EQUAL(counters.nCsMisses, 0);
 
   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);
+  BOOST_CHECK_EQUAL(counters.nInData, 0);
+  BOOST_CHECK_EQUAL(counters.nOutData, 1);
 
   this->advanceClocks(100_ms, 500_ms);
   // PIT entry should not be left behind
   BOOST_CHECK_EQUAL(pit.size(), 0);
+
+  BOOST_CHECK_EQUAL(counters.nSatisfiedInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nUnsatisfiedInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nUnsolicitedData, 0);
 }
 
 BOOST_AUTO_TEST_CASE(InterestWithoutNonce)
@@ -148,9 +174,12 @@
   face1->receiveInterest(*interest);
 
   // 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_CHECK_EQUAL(face2->sentInterests[0].hasNonce(), true);
+  BOOST_CHECK_EQUAL(face2->getCounters().nOutInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 0);
 }
 
 BOOST_AUTO_TEST_CASE(OutgoingInterest)
@@ -175,7 +204,9 @@
   BOOST_CHECK(outA3 == nullptr);
 
   BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 1);
-  BOOST_CHECK_EQUAL(face2->sentInterests.back().getNonce(), 1698);
+  BOOST_CHECK_EQUAL(face2->sentInterests[0].getNonce(), 1698);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 1);
 }
 
 BOOST_AUTO_TEST_CASE(NextHopFaceId)
@@ -195,7 +226,10 @@
   this->advanceClocks(100_ms, 1_s);
   BOOST_CHECK_EQUAL(face3->sentInterests.size(), 0);
   BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 1);
-  BOOST_CHECK_EQUAL(face2->sentInterests.front().getName(), "/A/B");
+  BOOST_CHECK_EQUAL(face2->sentInterests[0].getName(), "/A/B");
+  BOOST_CHECK_EQUAL(counters.nInInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 0);
 }
 
 BOOST_AUTO_TEST_CASE(HopLimit)
@@ -217,7 +251,9 @@
   BOOST_CHECK_EQUAL(faceRemote->getCounters().nInHopLimitZero, 0);
   BOOST_CHECK_EQUAL(faceRemote->getCounters().nOutHopLimitZero, 0);
   BOOST_REQUIRE_EQUAL(faceRemote->sentInterests.size(), 1);
-  BOOST_CHECK(!faceRemote->sentInterests.back().getHopLimit());
+  BOOST_CHECK(!faceRemote->sentInterests[0].getHopLimit());
+  BOOST_CHECK_EQUAL(counters.nInInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 1);
 
   // Incoming interest w/ HopLimit > 1 will not be dropped on send/receive
   auto interestHopLimit2 = makeInterest("/remote/ijklmnop");
@@ -228,8 +264,10 @@
   BOOST_CHECK_EQUAL(faceRemote->getCounters().nInHopLimitZero, 0);
   BOOST_CHECK_EQUAL(faceRemote->getCounters().nOutHopLimitZero, 0);
   BOOST_REQUIRE_EQUAL(faceRemote->sentInterests.size(), 2);
-  BOOST_REQUIRE(faceRemote->sentInterests.back().getHopLimit());
-  BOOST_CHECK_EQUAL(*faceRemote->sentInterests.back().getHopLimit(), 1);
+  BOOST_REQUIRE(faceRemote->sentInterests[1].getHopLimit());
+  BOOST_CHECK_EQUAL(*faceRemote->sentInterests[1].getHopLimit(), 1);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 2);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 2);
 
   // Incoming interest w/ HopLimit == 1 will be dropped on send path if going out on remote face
   auto interestHopLimit1Remote = makeInterest("/remote/qrstuvwx");
@@ -240,6 +278,8 @@
   BOOST_CHECK_EQUAL(faceRemote->getCounters().nInHopLimitZero, 0);
   BOOST_CHECK_EQUAL(faceRemote->getCounters().nOutHopLimitZero, 1);
   BOOST_CHECK_EQUAL(faceRemote->sentInterests.size(), 2);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 3);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 2);
 
   // Incoming interest w/ HopLimit == 1 will not be dropped on send path if going out on local face
   auto interestHopLimit1Local = makeInterest("/local/abcdefgh");
@@ -250,8 +290,10 @@
   BOOST_CHECK_EQUAL(faceLocal->getCounters().nInHopLimitZero, 0);
   BOOST_CHECK_EQUAL(faceLocal->getCounters().nOutHopLimitZero, 0);
   BOOST_REQUIRE_EQUAL(faceLocal->sentInterests.size(), 1);
-  BOOST_REQUIRE(faceLocal->sentInterests.back().getHopLimit());
-  BOOST_CHECK_EQUAL(*faceLocal->sentInterests.back().getHopLimit(), 0);
+  BOOST_REQUIRE(faceLocal->sentInterests[0].getHopLimit());
+  BOOST_CHECK_EQUAL(*faceLocal->sentInterests[0].getHopLimit(), 0);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 4);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 3);
 
   // Interest w/ HopLimit == 0 will be dropped on receive path
   auto interestHopLimit0 = makeInterest("/remote/yzabcdef");
@@ -262,6 +304,10 @@
   BOOST_CHECK_EQUAL(faceIn->getCounters().nInHopLimitZero, 1);
   BOOST_CHECK_EQUAL(faceRemote->getCounters().nOutHopLimitZero, 1);
   BOOST_CHECK_EQUAL(faceRemote->sentInterests.size(), 2);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 5);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 3);
+
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 0);
 }
 
 BOOST_AUTO_TEST_CASE(AddDefaultHopLimit)
@@ -302,52 +348,63 @@
   auto face2 = addFace(); // default is non-local
 
   auto& strategy = choose<DummyStrategy>(forwarder, "/", DummyStrategy::getStrategyName());
+  strategy.afterReceiveInterest_count = 0;
 
   // local face, /localhost: OK
-  strategy.afterReceiveInterest_count = 0;
   auto i1 = makeInterest("/localhost/A1");
   forwarder.onIncomingInterest(*i1, FaceEndpoint(*face1));
+  BOOST_CHECK_EQUAL(counters.nInInterests, 1);
   BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
 
   // non-local face, /localhost: violate
-  strategy.afterReceiveInterest_count = 0;
   auto i2 = makeInterest("/localhost/A2");
   forwarder.onIncomingInterest(*i2, FaceEndpoint(*face2));
-  BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 0);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 2);
+  BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
 
   // local face, non-/localhost: OK
-  strategy.afterReceiveInterest_count = 0;
   auto i3 = makeInterest("/A3");
   forwarder.onIncomingInterest(*i3, FaceEndpoint(*face1));
-  BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 3);
+  BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 2);
 
   // non-local face, non-/localhost: OK
-  strategy.afterReceiveInterest_count = 0;
   auto i4 = makeInterest("/A4");
   forwarder.onIncomingInterest(*i4, FaceEndpoint(*face2));
-  BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 4);
+  BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 3);
 
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 0);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nInData, 0);
+  BOOST_CHECK_EQUAL(counters.nOutData, 0);
+  BOOST_CHECK_EQUAL(counters.nUnsolicitedData, 0);
 
   // local face, /localhost: OK
   auto d1 = makeData("/localhost/B1");
   forwarder.onIncomingData(*d1, FaceEndpoint(*face1));
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
+  BOOST_CHECK_EQUAL(counters.nInData, 1);
+  BOOST_CHECK_EQUAL(counters.nUnsolicitedData, 1);
 
   // non-local face, /localhost: violate
   auto d2 = makeData("/localhost/B2");
   forwarder.onIncomingData(*d2, FaceEndpoint(*face2));
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
+  BOOST_CHECK_EQUAL(counters.nInData, 2);
+  BOOST_CHECK_EQUAL(counters.nUnsolicitedData, 1);
 
   // local face, non-/localhost: OK
   auto d3 = makeData("/B3");
   forwarder.onIncomingData(*d3, FaceEndpoint(*face1));
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 2);
+  BOOST_CHECK_EQUAL(counters.nInData, 3);
+  BOOST_CHECK_EQUAL(counters.nUnsolicitedData, 2);
 
   // non-local face, non-/localhost: OK
   auto d4 = makeData("/B4");
   forwarder.onIncomingData(*d4, FaceEndpoint(*face2));
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 3);
+  BOOST_CHECK_EQUAL(counters.nInData, 4);
+  BOOST_CHECK_EQUAL(counters.nUnsolicitedData, 3);
+
+  BOOST_CHECK_EQUAL(counters.nOutData, 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 0);
 }
 
 BOOST_AUTO_TEST_CASE(IncomingInterestStrategyDispatch)
@@ -386,6 +443,17 @@
   forwarder.onIncomingInterest(*interest3, FaceEndpoint(*face1));
   auto interest4 = makeInterest("/B/4", false, 5_s);
   forwarder.onIncomingInterest(*interest4, FaceEndpoint(*face1));
+
+  this->advanceClocks(1_ms, 5_ms);
+
+  BOOST_CHECK_EQUAL(counters.nInInterests, 4);
+  BOOST_CHECK_EQUAL(counters.nInData, 2);
+  BOOST_CHECK_EQUAL(counters.nInNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nSatisfiedInterests, 2);
+  BOOST_CHECK_EQUAL(counters.nUnsatisfiedInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nUnsolicitedData, 0);
+  BOOST_CHECK_EQUAL(counters.nCsHits, 0);
+  BOOST_CHECK_EQUAL(counters.nCsMisses, 4);
 }
 
 BOOST_AUTO_TEST_CASE(IncomingData)
@@ -417,9 +485,11 @@
   BOOST_CHECK_EQUAL(face3->sentData.size(), 0);
   BOOST_CHECK_EQUAL(face4->sentData.size(), 1);
 
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nInData, 1);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nOutData, 3);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 0);
+  BOOST_CHECK_EQUAL(counters.nInData, 1);
+  BOOST_CHECK_EQUAL(counters.nOutData, 3);
+  BOOST_CHECK_EQUAL(counters.nSatisfiedInterests, 3);
+  BOOST_CHECK_EQUAL(counters.nUnsatisfiedInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nUnsolicitedData, 0);
 }
 
 BOOST_AUTO_TEST_CASE(OutgoingData)
@@ -435,7 +505,9 @@
   face1->sentData.clear();
   BOOST_CHECK(forwarder.onOutgoingData(*data, *face1));
   BOOST_REQUIRE_EQUAL(face1->sentData.size(), 1);
-  BOOST_CHECK_EQUAL(face1->sentData.back().getName(), data->getName());
+  BOOST_CHECK_EQUAL(face1->sentData[0].getName(), data->getName());
+  BOOST_CHECK_EQUAL(counters.nInData, 0);
+  BOOST_CHECK_EQUAL(counters.nOutData, 1);
 
   // scope control
   face1->sentData.clear();
@@ -444,12 +516,16 @@
   BOOST_CHECK_EQUAL(face2->sentData.size(), 0);
   BOOST_CHECK(forwarder.onOutgoingData(*localData, *face1));
   BOOST_REQUIRE_EQUAL(face1->sentData.size(), 1);
-  BOOST_CHECK_EQUAL(face1->sentData.back().getName(), localData->getName());
+  BOOST_CHECK_EQUAL(face1->sentData[0].getName(), localData->getName());
+  BOOST_CHECK_EQUAL(counters.nInData, 0);
+  BOOST_CHECK_EQUAL(counters.nOutData, 2);
 
   // face with invalid ID
   face3->sentData.clear();
   BOOST_CHECK(!forwarder.onOutgoingData(*data, *face3));
   BOOST_CHECK_EQUAL(face3->sentData.size(), 0);
+  BOOST_CHECK_EQUAL(counters.nInData, 0);
+  BOOST_CHECK_EQUAL(counters.nOutData, 2);
 }
 
 BOOST_AUTO_TEST_CASE(IncomingNack)
@@ -529,6 +605,13 @@
   forwarder.onIncomingNack(nack4a, FaceEndpoint(*face3));
   BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
   BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
+
+  this->advanceClocks(1_ms, 10_ms);
+
+  BOOST_CHECK_EQUAL(counters.nInNacks, 6);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nSatisfiedInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nUnsatisfiedInterests, 2);
 }
 
 BOOST_AUTO_TEST_CASE(OutgoingNack)
@@ -555,6 +638,7 @@
   face2->sentNacks.clear();
   BOOST_CHECK(!forwarder.onOutgoingNack(nackHeader, *face2, pit1));
   BOOST_CHECK_EQUAL(face2->sentNacks.size(), 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 0);
 
   // send Nack with correct Nonce
   auto interest2a = makeInterest("/Vi8tRm9MG3", false, std::nullopt, 152);
@@ -567,9 +651,10 @@
 
   BOOST_CHECK(forwarder.onOutgoingNack(nackHeader, *face1, pit2));
   BOOST_REQUIRE_EQUAL(face1->sentNacks.size(), 1);
-  BOOST_CHECK_EQUAL(face1->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
-  BOOST_CHECK_EQUAL(face1->sentNacks.back().getInterest().getNonce(), 152);
+  BOOST_CHECK_EQUAL(face1->sentNacks[0].getReason(), lp::NackReason::CONGESTION);
+  BOOST_CHECK_EQUAL(face1->sentNacks[0].getInterest().getNonce(), 152);
   BOOST_CHECK_EQUAL(face2->sentNacks.size(), 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 1);
 
   // in-record is erased
   auto inRecord2a = pit2->getInRecord(*face1);
@@ -579,8 +664,9 @@
   BOOST_CHECK(forwarder.onOutgoingNack(nackHeader, *face2, pit2));
   BOOST_CHECK_EQUAL(face1->sentNacks.size(), 1);
   BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1);
-  BOOST_CHECK_EQUAL(face2->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
-  BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest().getNonce(), 808);
+  BOOST_CHECK_EQUAL(face2->sentNacks[0].getReason(), lp::NackReason::CONGESTION);
+  BOOST_CHECK_EQUAL(face2->sentNacks[0].getInterest().getNonce(), 808);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 2);
 
   // in-record is erased
   auto inRecord2b = pit2->getInRecord(*face2);
@@ -593,6 +679,7 @@
   face3->sentNacks.clear();
   BOOST_CHECK(!forwarder.onOutgoingNack(nackHeader, *face3, pit2));
   BOOST_CHECK_EQUAL(face3->sentNacks.size(), 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 2);
 
   // don't send Nack to face with invalid ID
   auto interest1b = makeInterest("/fM5IVEtC", false, std::nullopt, 553);
@@ -601,6 +688,7 @@
   face4->sentNacks.clear();
   BOOST_CHECK(!forwarder.onOutgoingNack(nackHeader, *face4, pit1));
   BOOST_CHECK_EQUAL(face4->sentNacks.size(), 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 2);
 }
 
 BOOST_AUTO_TEST_CASE(InterestLoopNack)
@@ -622,32 +710,52 @@
   auto interest1a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 732);
   face1->receiveInterest(*interest1a);
   BOOST_CHECK(face1->sentNacks.empty());
+  BOOST_CHECK_EQUAL(counters.nInInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nInNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 0);
 
   // receive Interest with duplicate Nonce on face1: legit retransmission
   face1->sentNacks.clear();
   auto interest1b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 732);
   face1->receiveInterest(*interest1b);
   BOOST_CHECK(face1->sentNacks.empty());
+  BOOST_CHECK_EQUAL(counters.nInInterests, 2);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nInNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 0);
 
   // receive Interest with duplicate Nonce on face2
   face2->sentNacks.clear();
   auto interest2a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 732);
   face2->receiveInterest(*interest2a);
   BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1);
-  BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest().wireEncode(), interest2a->wireEncode());
-  BOOST_CHECK_EQUAL(face2->sentNacks.back().getReason(), lp::NackReason::DUPLICATE);
+  BOOST_CHECK_EQUAL(face2->sentNacks[0].getInterest().wireEncode(), interest2a->wireEncode());
+  BOOST_CHECK_EQUAL(face2->sentNacks[0].getReason(), lp::NackReason::DUPLICATE);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 3);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nInNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 1);
 
   // receive Interest with new Nonce on face2
   face2->sentNacks.clear();
   auto interest2b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 944);
   face2->receiveInterest(*interest2b);
   BOOST_CHECK(face2->sentNacks.empty());
+  BOOST_CHECK_EQUAL(counters.nInInterests, 4);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nInNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 1);
 
   // receive Interest with duplicate Nonce on face3, don't send Nack to multi-access face
   face3->sentNacks.clear();
   auto interest3a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 732);
   face3->receiveInterest(*interest3a);
   BOOST_CHECK(face3->sentNacks.empty());
+  BOOST_CHECK_EQUAL(counters.nInInterests, 5);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nInNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 1);
 }
 
 BOOST_AUTO_TEST_CASE(InterestLoopWithShortLifetime) // Bug 1953
@@ -671,16 +779,20 @@
   auto interest = makeInterest("/A/1", false, 50_ms, 82101183);
   face1->receiveInterest(*interest);
 
-  // interest should be forwarded only once, as long as Nonce is in Dead Nonce List
+  // Interest should be forwarded only once, as long as Nonce is in Dead Nonce List
   BOOST_ASSERT(25_ms * 40 < forwarder.getDeadNonceList().getLifetime());
   this->advanceClocks(25_ms, 40);
   BOOST_CHECK_EQUAL(face2->sentInterests.size(), 1);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 2);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nInNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 1);
 
   // It's unnecessary to check that Interest with duplicate Nonce can be forwarded again
   // after it's gone from Dead Nonce List, because the entry lifetime of Dead Nonce List
-  // is an implementation decision. NDN protocol requires Name+Nonce to be unique,
-  // without specifying when Name+Nonce could repeat. Forwarder is permitted to suppress
-  // an Interest if its Name+Nonce has appeared any point in the past.
+  // is an implementation decision. The NDN protocol requires Name+Nonce to be unique,
+  // without specifying when Name+Nonce could repeat. Theoretically, a forwarder is allowed
+  // to suppress an Interest if its Name+Nonce has appeared at any point in the past.
 }
 
 BOOST_AUTO_TEST_CASE(PitLeak) // Bug 3484
@@ -694,8 +806,11 @@
   BOOST_CHECK_EQUAL(pit.size(), 0);
 
   forwarder.onIncomingInterest(*interest, FaceEndpoint(*face1));
-  this->advanceClocks(100_ms, 20_s);
+  // PIT entry is never created if a loop is detected by the Dead Nonce List
   BOOST_CHECK_EQUAL(pit.size(), 0);
+  BOOST_CHECK_EQUAL(counters.nInInterests, 1);
+  BOOST_CHECK_EQUAL(counters.nOutInterests, 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 1);
 }
 
 BOOST_AUTO_TEST_CASE(UnsolicitedData)
@@ -703,10 +818,16 @@
   auto face1 = addFace();
   auto data = makeData("/A");
 
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 0);
+  BOOST_CHECK_EQUAL(counters.nInData, 0);
+  BOOST_CHECK_EQUAL(counters.nOutData, 0);
+  BOOST_CHECK_EQUAL(counters.nUnsolicitedData, 0);
+
   forwarder.onIncomingData(*data, FaceEndpoint(*face1));
   this->advanceClocks(1_ms, 10_ms);
-  BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
+  BOOST_CHECK_EQUAL(counters.nInData, 1);
+  BOOST_CHECK_EQUAL(counters.nOutData, 0);
+  BOOST_CHECK_EQUAL(counters.nOutNacks, 0);
+  BOOST_CHECK_EQUAL(counters.nUnsolicitedData, 1);
 }
 
 BOOST_AUTO_TEST_CASE(NewNextHop)