util: backport C++20 std::span and use it in various APIs
Implementation taken from span-lite by Martin Moene,
commit 337af6e23f6d3264136c16565546244da23159ba
Change-Id: Icfd0ba6841cbf6ef7870c31c881df940da9faf7e
diff --git a/tests/unit/security/transform/bool-sink.t.cpp b/tests/unit/security/transform/bool-sink.t.cpp
index f287e1c..a7640c6 100644
--- a/tests/unit/security/transform/bool-sink.t.cpp
+++ b/tests/unit/security/transform/bool-sink.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -34,23 +34,23 @@
BOOST_AUTO_TEST_CASE(Basic)
{
- uint8_t in1[] = {0x00, 0x01};
+ const uint8_t in1[] = {0x00, 0x01};
bool value1 = true;
BoolSink sink1(value1);
- BOOST_CHECK_EQUAL(sink1.write(in1, 1), 1);
- BOOST_CHECK_EQUAL(sink1.write(in1 + 1, 1), 1);
+ BOOST_CHECK_EQUAL(sink1.write({in1, 1}), 1);
+ BOOST_CHECK_EQUAL(sink1.write({in1 + 1, 1}), 1);
sink1.end();
BOOST_CHECK_EQUAL(value1, false);
- BOOST_CHECK_THROW(sink1.write(in1 + 1, 1), transform::Error);
+ BOOST_CHECK_THROW(sink1.write({in1 + 1, 1}), transform::Error);
- uint8_t in2[] = {0x01, 0x00};
+ const uint8_t in2[] = {0x01, 0x00};
bool value2 = false;
BoolSink sink2(value2);
- BOOST_CHECK_EQUAL(sink2.write(in2, 1), 1);
- BOOST_CHECK_EQUAL(sink2.write(in2 + 1, 1), 1);
+ BOOST_CHECK_EQUAL(sink2.write({in2, 1}), 1);
+ BOOST_CHECK_EQUAL(sink2.write({in2 + 1, 1}), 1);
sink2.end();
BOOST_CHECK_EQUAL(value2, true);
- BOOST_CHECK_THROW(sink2.write(in2 + 1, 1), transform::Error);
+ BOOST_CHECK_THROW(sink2.write({in2 + 1, 1}), transform::Error);
}
BOOST_AUTO_TEST_SUITE_END() // TestBoolSink