encoding: Fixing bugs in EncodingBlock and Block

Several Block constructors incorrectly initialized value boundaries.

Change-Id: I0d8a4fe73cc24530245862e0428e617437078bf0
refs: #1256, #1257
diff --git a/tests/test-block.cpp b/tests/test-block.cpp
new file mode 100644
index 0000000..c2fab26
--- /dev/null
+++ b/tests/test-block.cpp
@@ -0,0 +1,32 @@
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * See COPYING for copyright and distribution information.
+ */
+
+#include <boost/test/unit_test.hpp>
+
+#include "encoding/encoding-buffer.hpp"
+
+using namespace std;
+namespace ndn {
+
+BOOST_AUTO_TEST_SUITE(TestBlock)
+
+BOOST_AUTO_TEST_CASE (Decode)
+{
+  uint8_t value[4];
+
+  ndn::EncodingBuffer buffer;
+  size_t length = buffer.prependByteArray(value, sizeof(value));
+  buffer.prependVarNumber(length);
+  buffer.prependVarNumber(0xe0);
+
+  Block block;
+  BOOST_REQUIRE_NO_THROW(block = buffer.block());
+  BOOST_CHECK_EQUAL(block.type(), 0xe0);
+  BOOST_CHECK_EQUAL(block.value_size(), sizeof(value));
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace ndn