encoding/tlv: Updating type assignment and fixing test cases
Type assignment now reflects the latest NDN-TLV spec.
Change-Id: Ibcd73a81ac72ebbd2897006f49518156aa9981a3
diff --git a/tests_boost/test-encode-decode-data.cpp b/tests_boost/test-encode-decode-data.cpp
index 198fe71..15e5689 100644
--- a/tests_boost/test-encode-decode-data.cpp
+++ b/tests_boost/test-encode-decode-data.cpp
@@ -29,32 +29,32 @@
const uint8_t Content1[] = {0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x21};
const uint8_t Data1[] = {
-0x01, 0xc5, // NDN Data
- 0x02, 0x14, // Name
- 0x03, 0x05,
+0x02, 0xc5, // NDN Data
+ 0x03, 0x14, // Name
+ 0x04, 0x05,
0x6c, 0x6f, 0x63, 0x61, 0x6c,
- 0x03, 0x03,
+ 0x04, 0x03,
0x6e, 0x64, 0x6e,
- 0x03, 0x06,
+ 0x04, 0x06,
0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
- 0x0f, 0x04, // MetaInfo
- 0x14, 0x02, // FreshnessPeriod
+ 0x10, 0x04, // MetaInfo
+ 0x15, 0x02, // FreshnessPeriod
0x27, 0x10,
- 0x10, 0x08, // Content
+ 0x11, 0x08, // Content
0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x21,
- 0x11, 0x1b, // SignatureInfo
- 0x15, 0x01, // SignatureType
+ 0x12, 0x1b, // SignatureInfo
+ 0x16, 0x01, // SignatureType
0x01,
- 0x16, 0x16, // KeyLocator
- 0x02, 0x14, // Name
- 0x03, 0x04,
+ 0x17, 0x16, // KeyLocator
+ 0x03, 0x14, // Name
+ 0x04, 0x04,
0x74, 0x65, 0x73, 0x74,
- 0x03, 0x03,
+ 0x04, 0x03,
0x6b, 0x65, 0x79,
- 0x03, 0x07,
+ 0x04, 0x07,
0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72,
- 0x12, 0x80, // SignatureValue
- 0x41, 0x66, 0x82, 0xca, 0xdc, 0xf0, 0x34, 0x7a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0x78, 0xff, 0x0c, 0xb1, 0x8c, 0xc2, 0x45, 0x9a, 0xec, 0x4b, 0x87, 0x2b, 0x3a, 0x8d, 0x4c, 0xc7, 0x6c, 0x92, 0xa3, 0x72, 0x0e, 0xae, 0x2e, 0x13, 0xea, 0x5d, 0x1d, 0xce, 0x63, 0x10, 0x63, 0xb2, 0x19, 0xb7, 0x67, 0xb5, 0x7d, 0xbe, 0xac, 0xaf, 0xe2, 0xed, 0x71, 0xc1, 0x47, 0x10, 0x65, 0x7c, 0x69, 0x77, 0xe7, 0xf6, 0x69, 0xd6, 0x12, 0x2b, 0x97, 0x05, 0xe1, 0x71, 0xc0, 0xae, 0xc7, 0xe1, 0x8f, 0x99, 0x32, 0x4f, 0xd7
};
const unsigned char DEFAULT_PRIVATE_KEY_DER[] = {
@@ -195,7 +195,8 @@
BOOST_REQUIRE_NO_THROW(dataBlock = d.wireEncode());
BOOST_REQUIRE_EQUAL_COLLECTIONS(Data1, Data1+sizeof(Data1),
- dataBlock.begin(), dataBlock.end());
+ dataBlock.begin(), dataBlock.end());
+
}
diff --git a/tests_boost/test-encode-decode-interest.cpp b/tests_boost/test-encode-decode-interest.cpp
index ca2ffeb..32a319e 100644
--- a/tests_boost/test-encode-decode-interest.cpp
+++ b/tests_boost/test-encode-decode-interest.cpp
@@ -14,29 +14,39 @@
BOOST_AUTO_TEST_SUITE(TestInterest)
const uint8_t Interest1[] = {
- 0x0, 0x41,
- 0x2, 0x14,
- 0x3, 0x5, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
- 0x3, 0x3, 0x6e, 0x64, 0x6e,
- 0x3, 0x6, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
- 0x4, 0x1f,
- 0x8, 0x1, 0x1,
- 0x9, 0x1, 0x1,
- 0xb, 0x14,
- 0x3, 0x4, 0x61, 0x6c, 0x65, 0x78,
- 0x3, 0x4, 0x78, 0x78, 0x78, 0x78,
- 0xe, 0x0,
- 0x3, 0x4, 0x79, 0x79, 0x79, 0x79,
- 0xc, 0x1, 0x1,
- 0x5, 0x1, 0x1,
- 0x6, 0x1, 0x1,
- 0x7, 0x2, 0x3, 0xe8
+ 0x1, 0x41, // NDN Interest
+ 0x3, 0x14, // Name
+ 0x4, 0x5, // NameComponent
+ 0x6c, 0x6f, 0x63, 0x61, 0x6c,
+ 0x4, 0x3, // NameComponent
+ 0x6e, 0x64, 0x6e,
+ 0x4, 0x6, // NameComponent
+ 0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
+ 0x5, 0x1f, // Selectors
+ 0x09, 0x1, 0x1, // MinSuffix
+ 0x0a, 0x1, 0x1, // MaxSuffix
+ 0x0c, 0x14, // Exclude
+ 0x4, 0x4, // NameComponent
+ 0x61, 0x6c, 0x65, 0x78,
+ 0x4, 0x4, // NameComponent
+ 0x78, 0x78, 0x78, 0x78,
+ 0xf, 0x0, // Any
+ 0x4, 0x4, // NameComponent
+ 0x79, 0x79, 0x79, 0x79,
+ 0x0d, 0x1, // ChildSelector
+ 0x1,
+ 0x6, 0x1, // Nonce
+ 0x1,
+ 0x7, 0x1, // Scope
+ 0x1,
+ 0x8, // InterestLifetime
+ 0x2, 0x3, 0xe8
};
BOOST_AUTO_TEST_CASE (Decode)
{
Block interestBlock(Interest1, sizeof(Interest1));
-
+
ndn::Interest i;
BOOST_REQUIRE_NO_THROW(i.wireDecode(interestBlock));