daemon: Support query that explicitly specify version
Change-Id: I8eac2c5d2a646fbb965691498f8d416a86b70763
diff --git a/tests/unit/daemon/name-server.cpp b/tests/unit/daemon/name-server.cpp
index 32f911c..9e7a926 100644
--- a/tests/unit/daemon/name-server.cpp
+++ b/tests/unit/daemon/name-server.cpp
@@ -130,6 +130,34 @@
run();
BOOST_CHECK_EQUAL(nDataBack, 2);
+
+ // explicit interest with correct version
+ face->receive(Interest("/test19/KEY/dsk-1/ID-CERT/%FDd"));
+
+ face->onSendData.connectSingleShot([&] (const Data& data) {
+ ++nDataBack;
+
+ Response resp;
+ BOOST_CHECK_NO_THROW(resp.fromData(hint, zone, data));
+ BOOST_CHECK_EQUAL(resp.getNdnsType(), NDNS_RAW);
+ });
+
+ run();
+ BOOST_CHECK_EQUAL(nDataBack, 3);
+
+ // explicit interest with wrong version
+ face->receive(Interest("/test19/KEY/dsk-1/ID-CERT/%FD010101010"));
+
+ face->onSendData.connectSingleShot([&] (const Data& data) {
+ ++nDataBack;
+
+ Response resp;
+ BOOST_CHECK_NO_THROW(resp.fromData(hint, zone, data));
+ BOOST_CHECK_EQUAL(resp.getNdnsType(), NDNS_NACK);
+ });
+
+ run();
+ BOOST_CHECK_EQUAL(nDataBack, 4);
}
BOOST_AUTO_TEST_CASE(UpdateReplaceRr)
diff --git a/tests/unit/ndns-label.cpp b/tests/unit/ndns-label.cpp
index cb2e47e..09bb182 100644
--- a/tests/unit/ndns-label.cpp
+++ b/tests/unit/ndns-label.cpp
@@ -42,9 +42,9 @@
BOOST_CHECK_EQUAL(re.version, name::Component());
BOOST_CHECK_EQUAL(matchName(interest2, hint, zone, re), true);
- BOOST_CHECK_EQUAL(re.rrLabel, Name("/www/dsk-111/NS"));
- BOOST_CHECK_EQUAL(re.rrType, name::Component::fromEscapedString("%FD%00"));
- BOOST_CHECK_EQUAL(re.version, name::Component());
+ BOOST_CHECK_EQUAL(re.rrLabel, Name("/www/dsk-111"));
+ BOOST_CHECK_EQUAL(re.rrType, name::Component("NS"));
+ BOOST_CHECK_EQUAL(re.version, name::Component::fromEscapedString("%FD%00"));
}
BOOST_AUTO_TEST_CASE(MatchData)
@@ -54,7 +54,6 @@
Name zone("/net/ndnsim");
Data data1("/att/%F0./net/ndnsim/NDNS/www/dsk-111/NS/%FD%00");
- Data data2("/att/%F0./net/ndnsim/NDNS/www/dsk-111/NS");
MatchResult re;
BOOST_CHECK_EQUAL(matchName(data1, hint, zone, re), true);
@@ -62,11 +61,6 @@
BOOST_CHECK_EQUAL(re.rrType, name::Component("NS"));
BOOST_REQUIRE_NO_THROW(re.version.toVersion());
BOOST_CHECK_EQUAL(re.version.toVersion(), 0);
-
- BOOST_CHECK_EQUAL(matchName(data2, hint, zone, re), true);
- BOOST_CHECK_EQUAL(re.rrLabel, Name("/www"));
- BOOST_CHECK_EQUAL(re.rrType, name::Component("dsk-111"));
- BOOST_REQUIRE_THROW(re.version.toVersion(), ndn::tlv::Error);
}
BOOST_AUTO_TEST_SUITE_END()