data+interest: Fixing operator<<
Data packet was missing declaration of operator<< in header file.
Interest class has incorrect output of InterestLifetime parameter
(should be just number of milliseconds, without word "milliseconds"
present).
Change-Id: If2249ed033ab4b47640dfa4ea08253fdb84373d6
Refs: #1681
diff --git a/tests/unit-tests/test-data.cpp b/tests/unit-tests/test-data.cpp
index e7be94e..5ce434e 100644
--- a/tests/unit-tests/test-data.cpp
+++ b/tests/unit-tests/test-data.cpp
@@ -348,6 +348,15 @@
BOOST_REQUIRE_EQUAL_COLLECTIONS(Data1, Data1+sizeof(Data1),
dataBlock.begin(), dataBlock.end());
+
+ std::ostringstream strStream;
+ BOOST_CHECK_NO_THROW(strStream << d);
+
+ BOOST_CHECK_EQUAL(strStream.str(),
+ "Name: /local/ndn/prefix\n"
+ "MetaInfo: ContentType: 0, FreshnessPeriod: 10000 milliseconds\n"
+ "Content: (size: 8)\n"
+ "Signature: (type: 1, value_length: 128)\n");
}
class DataIdentityFixture
diff --git a/tests/unit-tests/test-interest.cpp b/tests/unit-tests/test-interest.cpp
index f02a8a8..0b397cf 100644
--- a/tests/unit-tests/test-interest.cpp
+++ b/tests/unit-tests/test-interest.cpp
@@ -341,6 +341,16 @@
BOOST_CHECK_EQUAL_COLLECTIONS(Interest2, Interest2 + sizeof(Interest2),
wire.begin(), wire.end());
+
+ std::ostringstream strStream;
+ BOOST_CHECK_NO_THROW(strStream << i);
+
+ BOOST_CHECK_EQUAL(strStream.str(),
+ "/local/ndn/prefix?"
+ "ndn.MinSuffixComponents=1&ndn.MaxSuffixComponents=1&"
+ "ndn.ChildSelector=1&ndn.Scope=1&"
+ "ndn.InterestLifetime=1000&"
+ "ndn.Nonce=2&ndn.Exclude=alex,xxxx,*,yyyy");
}
BOOST_AUTO_TEST_CASE(EncodeWithLocalHeader)