security: Validator::verifySignature don't throw on Interest with malformed signature
refs #3723
Change-Id: I7de6ab667ffbcc531a5ea8bccae1551e1699cefd
diff --git a/tests/unit-tests/make-interest-data.hpp b/tests/unit-tests/make-interest-data.hpp
index 36c8deb..8dea8bf 100644
--- a/tests/unit-tests/make-interest-data.hpp
+++ b/tests/unit-tests/make-interest-data.hpp
@@ -81,6 +81,30 @@
lp::Nack
makeNack(const Name& name, uint32_t nonce, lp::NackReason reason);
+/** \brief replace a name component
+ * \param[inout] name name
+ * \param index name component index
+ * \param a arguments to name::Component constructor
+ */
+template<typename...A>
+void
+setNameComponent(Name& name, ssize_t index, const A& ...a)
+{
+ Name name2 = name.getPrefix(index);
+ name2.append(name::Component(a...));
+ name2.append(name.getSubName(name2.size()));
+ name = name2;
+}
+
+template<typename PKT, typename...A>
+void
+setNameComponent(PKT& pkt, ssize_t index, const A& ...a)
+{
+ Name name = pkt.getName();
+ setNameComponent(name, index, a...);
+ pkt.setName(name);
+}
+
} // namespace tests
} // namespace ndn