interest: deprecate selectors
NDN Packet Format v0.3 replaces Selectors with CanBePrefix
and MustBeFresh elements.
This commit deprecates getter/setter for Selectors in Interest
class. Getter/setter for CanBePrefix and MustBeFresh are mapped
to the closest v0.2 semantics and encoded as selectors.
refs #4527
Change-Id: Ie3d58d3d73f3bf1d8db3327943e6850a867465b0
diff --git a/tests/unit-tests/interest.t.cpp b/tests/unit-tests/interest.t.cpp
index 4fe7288..4d970d5 100644
--- a/tests/unit-tests/interest.t.cpp
+++ b/tests/unit-tests/interest.t.cpp
@@ -278,6 +278,42 @@
// ---- field accessors ----
+BOOST_AUTO_TEST_CASE(CanBePrefix)
+{
+ Interest i;
+ BOOST_CHECK_EQUAL(i.getCanBePrefix(), true);
+ i.setCanBePrefix(false);
+ BOOST_CHECK_EQUAL(i.getCanBePrefix(), false);
+ BOOST_CHECK_EQUAL(i.getSelectors().getMaxSuffixComponents(), 1);
+ i.setCanBePrefix(true);
+ BOOST_CHECK_EQUAL(i.getCanBePrefix(), true);
+ BOOST_CHECK_EQUAL(i.getSelectors().getMaxSuffixComponents(), -1);
+}
+
+BOOST_AUTO_TEST_CASE(MustBeFresh)
+{
+ Interest i;
+ BOOST_CHECK_EQUAL(i.getMustBeFresh(), false);
+ i.setMustBeFresh(true);
+ BOOST_CHECK_EQUAL(i.getMustBeFresh(), true);
+ BOOST_CHECK_EQUAL(i.getSelectors().getMustBeFresh(), true);
+ i.setMustBeFresh(false);
+ BOOST_CHECK_EQUAL(i.getMustBeFresh(), false);
+ BOOST_CHECK_EQUAL(i.getSelectors().getMustBeFresh(), false);
+}
+
+BOOST_AUTO_TEST_CASE(ModifyForwardingHint)
+{
+ Interest i;
+ i.setForwardingHint({{1, "/A"}});
+ i.wireEncode();
+ BOOST_CHECK(i.hasWire());
+
+ i.modifyForwardingHint([] (DelegationList& fh) { fh.insert(2, "/B"); });
+ BOOST_CHECK(!i.hasWire());
+ BOOST_CHECK_EQUAL(i.getForwardingHint(), DelegationList({{1, "/A"}, {2, "/B"}}));
+}
+
BOOST_AUTO_TEST_CASE(GetNonce)
{
unique_ptr<Interest> i1, i2;
@@ -347,18 +383,6 @@
BOOST_CHECK_EQUAL(i.getInterestLifetime(), 1_ms);
}
-BOOST_AUTO_TEST_CASE(ModifyForwardingHint)
-{
- Interest i;
- i.setForwardingHint({{1, "/A"}});
- i.wireEncode();
- BOOST_CHECK(i.hasWire());
-
- i.modifyForwardingHint([] (DelegationList& fh) { fh.insert(2, "/B"); });
- BOOST_CHECK(!i.hasWire());
- BOOST_CHECK_EQUAL(i.getForwardingHint(), DelegationList({{1, "/A"}, {2, "/B"}}));
-}
-
// ---- operators ----
BOOST_AUTO_TEST_CASE(Equality)