encoding: convert to span
Change-Id: I8bd73284fbd5acc0ff8ad2626af9b4324e9df7a1
diff --git a/tests/unit/util/io.t.cpp b/tests/unit/util/io.t.cpp
index 8b19fe3..ebe5799 100644
--- a/tests/unit/util/io.t.cpp
+++ b/tests/unit/util/io.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 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).
*
@@ -67,7 +67,7 @@
{
T t;
std::ostringstream os(std::ios_base::binary);
- io::saveBuffer(t.blob.data(), t.blob.size(), os, t.encoding);
+ io::saveBuffer(t.blob, os, t.encoding);
BOOST_CHECK_EQUAL(os.str(), t.stream.str());
}
@@ -86,7 +86,7 @@
NullStreambuf nullbuf;
std::ostream out(&nullbuf);
const Buffer buffer(1);
- BOOST_CHECK_THROW(io::saveBuffer(buffer.data(), buffer.size(), out, io::NO_ENCODING), io::Error);
+ BOOST_CHECK_THROW(io::saveBuffer(buffer, out, io::NO_ENCODING), io::Error);
}
BOOST_AUTO_TEST_CASE(UnknownIoEncoding)
@@ -94,7 +94,7 @@
std::stringstream ss;
BOOST_CHECK_THROW(io::loadTlv<Name>(ss, static_cast<io::IoEncoding>(5)), std::invalid_argument);
BOOST_CHECK_THROW(io::loadBuffer(ss, static_cast<io::IoEncoding>(5)), std::invalid_argument);
- BOOST_CHECK_THROW(io::saveBuffer(nullptr, 0, ss, static_cast<io::IoEncoding>(5)), std::invalid_argument);
+ BOOST_CHECK_THROW(io::saveBuffer({}, ss, static_cast<io::IoEncoding>(5)), std::invalid_argument);
}
class FileIoFixture
diff --git a/tests/unit/util/sha256.t.cpp b/tests/unit/util/sha256.t.cpp
index 501a015..3340204 100644
--- a/tests/unit/util/sha256.t.cpp
+++ b/tests/unit/util/sha256.t.cpp
@@ -134,7 +134,7 @@
auto expected = fromHex("b372edfd4d6a4db2cfeaeead6c34fdee9b9e759f7b8d799cf8067e39e7f2886c");
Sha256 statefulSha256;
- statefulSha256 << Block{input, sizeof(input)};
+ statefulSha256 << Block{input};
ConstBufferPtr digest = statefulSha256.computeDigest();
BOOST_CHECK_EQUAL(statefulSha256.empty(), false);
diff --git a/tests/unit/util/simple-notification.hpp b/tests/unit/util/simple-notification.hpp
index 280045a..acfa172 100644
--- a/tests/unit/util/simple-notification.hpp
+++ b/tests/unit/util/simple-notification.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021 Regents of the University of California,
+ * Copyright (c) 2014-2022 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,7 +28,7 @@
#ifndef NDN_CXX_TESTS_UNIT_UTIL_SIMPLE_NOTIFICATION_HPP
#define NDN_CXX_TESTS_UNIT_UTIL_SIMPLE_NOTIFICATION_HPP
-#include "ndn-cxx/encoding/encoding-buffer.hpp"
+#include "ndn-cxx/encoding/block-helpers.hpp"
namespace ndn {
namespace util {
@@ -53,11 +53,7 @@
Block
wireEncode() const
{
- ndn::EncodingBuffer buffer;
- buffer.prependByteArrayBlock(0x8888,
- reinterpret_cast<const uint8_t*>(m_message.c_str()),
- m_message.size());
- return buffer.block();
+ return makeStringBlock(0x8888, m_message);
}
void