encoding: make Block convertible to span

Change-Id: Idb501467d1c56b95e7fdb76acda63b919fe98f85
diff --git a/tests/unit/util/io.t.cpp b/tests/unit/util/io.t.cpp
index ebe5799..270270c 100644
--- a/tests/unit/util/io.t.cpp
+++ b/tests/unit/util/io.t.cpp
@@ -187,10 +187,7 @@
   void
   wireDecode(const Block& block)
   {
-    // block must be 0xBB, 0x01, 0xEE
-    BOOST_CHECK_EQUAL(block.type(), 0xBB);
-    BOOST_REQUIRE_EQUAL(block.value_size(), 1);
-    BOOST_CHECK_EQUAL(block.value()[0], 0xEE);
+    BOOST_TEST(block == "BB01EE"_block);
   }
 };
 
diff --git a/tests/unit/util/sha256.t.cpp b/tests/unit/util/sha256.t.cpp
index ae4fea3..c5fd1fd 100644
--- a/tests/unit/util/sha256.t.cpp
+++ b/tests/unit/util/sha256.t.cpp
@@ -112,7 +112,22 @@
   BOOST_TEST(*digest == *expected, boost::test_tools::per_element());
 }
 
-BOOST_AUTO_TEST_CASE(InsertionOperatorBlock)
+BOOST_AUTO_TEST_CASE(InsertionOperatorUnsignedInt)
+{
+  const uint64_t input[] = {1, 2, 3, 4};
+  auto expected = fromHex("7236c00c170036c6de133a878210ddd58567aa1d0619a0f70f69e38ae6f916e9");
+
+  Sha256 statefulSha256;
+  for (size_t i = 0; i < sizeof(input) / sizeof(uint64_t); ++i) {
+    statefulSha256 << boost::endian::native_to_big(input[i]);
+  }
+  ConstBufferPtr digest = statefulSha256.computeDigest();
+
+  BOOST_CHECK_EQUAL(statefulSha256.empty(), false);
+  BOOST_TEST(*digest == *expected, boost::test_tools::per_element());
+}
+
+BOOST_AUTO_TEST_CASE(InsertionOperatorSpan)
 {
   const uint8_t input[] = {
     0x16, 0x1b, // SignatureInfo
@@ -130,22 +145,7 @@
   auto expected = fromHex("b372edfd4d6a4db2cfeaeead6c34fdee9b9e759f7b8d799cf8067e39e7f2886c");
 
   Sha256 statefulSha256;
-  statefulSha256 << Block{input};
-  ConstBufferPtr digest = statefulSha256.computeDigest();
-
-  BOOST_CHECK_EQUAL(statefulSha256.empty(), false);
-  BOOST_TEST(*digest == *expected, boost::test_tools::per_element());
-}
-
-BOOST_AUTO_TEST_CASE(InsertionOperatorUint64t)
-{
-  const uint64_t input[] = {1, 2, 3, 4};
-  auto expected = fromHex("7236c00c170036c6de133a878210ddd58567aa1d0619a0f70f69e38ae6f916e9");
-
-  Sha256 statefulSha256;
-  for (size_t i = 0; i < sizeof(input) / sizeof(uint64_t); ++i) {
-    statefulSha256 << boost::endian::native_to_big(input[i]);
-  }
+  statefulSha256 << input;
   ConstBufferPtr digest = statefulSha256.computeDigest();
 
   BOOST_CHECK_EQUAL(statefulSha256.empty(), false);
@@ -166,14 +166,6 @@
   BOOST_CHECK_NO_THROW(sha << 42);
 }
 
-BOOST_AUTO_TEST_CASE(Error)
-{
-  Sha256 sha;
-  sha << 42;
-  sha.computeDigest(); // finalize
-  BOOST_CHECK_THROW(sha << 42, Sha256::Error);
-}
-
 BOOST_AUTO_TEST_CASE(StaticComputeDigest)
 {
   auto expected = fromHex("9f64a747e1b97f131fabb6b447296c9b6f0201e79fb3c5356e6c77e89b6a806a");
@@ -182,6 +174,14 @@
   BOOST_TEST(*digest == *expected, boost::test_tools::per_element());
 }
 
+BOOST_AUTO_TEST_CASE(Error)
+{
+  Sha256 sha;
+  sha << 42;
+  sha.computeDigest(); // finalize
+  BOOST_CHECK_THROW(sha << 42, Sha256::Error);
+}
+
 BOOST_AUTO_TEST_CASE(Print)
 {
   const uint8_t origin[] = {0x94, 0xEE, 0x05, 0x93, 0x35, 0xE5, 0x87, 0xE5,
diff --git a/tests/unit/util/simple-notification.hpp b/tests/unit/util/simple-notification.hpp
index acfa172..ece2c48 100644
--- a/tests/unit/util/simple-notification.hpp
+++ b/tests/unit/util/simple-notification.hpp
@@ -59,8 +59,7 @@
   void
   wireDecode(const Block& block)
   {
-    m_message.assign(reinterpret_cast<const char*>(block.value()),
-                     block.value_size());
+    m_message = readString(block);
 
     // error for testing
     if (!m_message.empty() && m_message[0] == '\x07')
diff --git a/tests/unit/util/sqlite3-statement.t.cpp b/tests/unit/util/sqlite3-statement.t.cpp
index a78b077..99ea89f 100644
--- a/tests/unit/util/sqlite3-statement.t.cpp
+++ b/tests/unit/util/sqlite3-statement.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -98,7 +98,7 @@
 
   {
     Sqlite3Statement stmt(db, "INSERT INTO test VALUES (5, ?)");
-    stmt.bind(1, reinterpret_cast<const void*>(block.wire()), block.size(), SQLITE_STATIC);
+    stmt.bind(1, reinterpret_cast<const void*>(block.data()), block.size(), SQLITE_STATIC);
     stmt.step();
   }