face: scoped pending Interest
refs #4316
Change-Id: I79f832ce599f09a4d5bbf8cd8c4656d677dd164c
diff --git a/tests/unit/face.t.cpp b/tests/unit/face.t.cpp
index 7f4ba07..43b4db5 100644
--- a/tests/unit/face.t.cpp
+++ b/tests/unit/face.t.cpp
@@ -267,7 +267,7 @@
} while (false));
}
-BOOST_AUTO_TEST_CASE(RemovePendingInterest)
+BOOST_AUTO_TEST_CASE(RemovePendingInterestId)
{
const PendingInterestId* interestId =
face.expressInterest(*makeInterest("/Hello/World", true, 50_ms),
@@ -286,6 +286,24 @@
BOOST_CHECK(true);
}
+BOOST_AUTO_TEST_CASE(CancelPendingInterestHandle)
+{
+ auto hdl = face.expressInterest(*makeInterest("/Hello/World", true, 50_ms),
+ bind([] { BOOST_FAIL("Unexpected data"); }),
+ bind([] { BOOST_FAIL("Unexpected nack"); }),
+ bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ advanceClocks(10_ms);
+
+ hdl.cancel();
+ advanceClocks(10_ms);
+
+ face.receive(*makeData("/Hello/World/%21"));
+ advanceClocks(200_ms, 5);
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
+}
+
BOOST_AUTO_TEST_CASE(RemoveAllPendingInterests)
{
face.expressInterest(*makeInterest("/Hello/World/0", false, 50_ms),