encoding: Refactoring EncodingBuffer
Breaks: nfd:commit:c0273e3505ac2ccf843401be77a513d8eb663127
Breaks: ChronoSync:commit:e042f83a1df184a8e7a90ef00034d11026891cd1
Change-Id: I8275c6276c5ecfa280f87f584189907521febf5f
Refs: #2494, #2490
diff --git a/tests/unit-tests/test-name.cpp b/tests/unit-tests/test-name.cpp
index e2f45ab..0eef98b 100644
--- a/tests/unit-tests/test-name.cpp
+++ b/tests/unit-tests/test-name.cpp
@@ -459,6 +459,37 @@
BOOST_CHECK_GE(name::Component("A"), comp0);
}
+BOOST_AUTO_TEST_CASE(CreateComponentWithIterators) // Bug #2490
+{
+ {
+ std::vector<uint8_t> bytes = {1};
+ name::Component c(bytes.begin(), bytes.end());
+ BOOST_CHECK_EQUAL(c.value_size(), 1);
+ BOOST_CHECK_EQUAL(c.size(), 3);
+ }
+
+ {
+ std::list<uint8_t> bytes = {1, 2, 3, 4};
+ name::Component c(bytes.begin(), bytes.end());
+ BOOST_CHECK_EQUAL(c.value_size(), 4);
+ BOOST_CHECK_EQUAL(c.size(), 6);
+ }
+
+ {
+ std::vector<int8_t> bytes = {1};
+ name::Component c(bytes.begin(), bytes.end());
+ BOOST_CHECK_EQUAL(c.value_size(), 1);
+ BOOST_CHECK_EQUAL(c.size(), 3);
+ }
+
+ {
+ std::list<int8_t> bytes = {1, 2, 3, 4};
+ name::Component c(bytes.begin(), bytes.end());
+ BOOST_CHECK_EQUAL(c.value_size(), 4);
+ BOOST_CHECK_EQUAL(c.size(), 6);
+ }
+}
+
BOOST_AUTO_TEST_SUITE_END()
} // namespace ndn