Move BOOST_CONCEPT_ASSERT to unit tests where possible
Change-Id: I0c6ae494eb7be4ab2ff422ba6d866ead9e75f4eb
diff --git a/tests/unit/data.t.cpp b/tests/unit/data.t.cpp
index 5162f4d..5706a3e 100644
--- a/tests/unit/data.t.cpp
+++ b/tests/unit/data.t.cpp
@@ -37,6 +37,13 @@
namespace ndn {
namespace tests {
+BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Data>));
+BOOST_CONCEPT_ASSERT((WireEncodable<Data>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Data>));
+BOOST_CONCEPT_ASSERT((WireDecodable<Data>));
+static_assert(std::is_convertible_v<Data::Error*, tlv::Error*>,
+ "Data::Error must inherit from tlv::Error");
+
BOOST_AUTO_TEST_SUITE(TestData)
const uint8_t CONTENT1[] = {0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x21};
diff --git a/tests/unit/encoding/block.t.cpp b/tests/unit/encoding/block.t.cpp
index 2c75944..f75eaf0 100644
--- a/tests/unit/encoding/block.t.cpp
+++ b/tests/unit/encoding/block.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -34,6 +34,8 @@
namespace ndn {
namespace tests {
+BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Block>));
+
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestBlock)
diff --git a/tests/unit/face.t.cpp b/tests/unit/face.t.cpp
index 94a2649..9d622ed 100644
--- a/tests/unit/face.t.cpp
+++ b/tests/unit/face.t.cpp
@@ -35,7 +35,6 @@
namespace tests {
using ndn::util::DummyClientFace;
-using std::bind;
struct WantPrefixRegReply;
struct NoPrefixRegReply;
@@ -100,8 +99,8 @@
BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
++nData;
},
- bind([] { BOOST_FAIL("Unexpected Nack"); }),
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
advanceClocks(40_ms);
@@ -116,9 +115,9 @@
size_t nTimeouts = 0;
face.expressInterest(*makeInterest("/Hello/World/a/2", false, 50_ms),
- bind([]{}),
- bind([]{}),
- bind([&nTimeouts] { ++nTimeouts; }));
+ std::bind([]{}),
+ std::bind([]{}),
+ std::bind([&nTimeouts] { ++nTimeouts; }));
advanceClocks(200_ms, 5);
BOOST_CHECK_EQUAL(nTimeouts, 1);
}
@@ -129,13 +128,13 @@
face.expressInterest(*makeInterest("/Hello/World", true, 50_ms),
[&] (const auto&, const auto&) { ++nData; },
- bind([] { BOOST_FAIL("Unexpected Nack"); }),
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
face.expressInterest(*makeInterest("/Hello/World/a", true, 50_ms),
[&] (const auto&, const auto&) { ++nData; },
- bind([] { BOOST_FAIL("Unexpected Nack"); }),
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
advanceClocks(40_ms);
@@ -152,8 +151,8 @@
{
face.expressInterest(*makeInterest("/Hello/World", true),
nullptr,
- bind([] { BOOST_FAIL("Unexpected Nack"); }),
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
advanceClocks(1_ms);
BOOST_CHECK_NO_THROW(do {
@@ -166,8 +165,8 @@
{
size_t nTimeouts = 0;
face.expressInterest(*makeInterest("/Hello/World", false, 50_ms),
- bind([] { BOOST_FAIL("Unexpected Data"); }),
- bind([] { BOOST_FAIL("Unexpected Nack"); }),
+ std::bind([] { BOOST_FAIL("Unexpected Data"); }),
+ std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
[&nTimeouts] (const Interest& i) {
BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
++nTimeouts;
@@ -184,8 +183,8 @@
BOOST_AUTO_TEST_CASE(EmptyTimeoutCallback)
{
face.expressInterest(*makeInterest("/Hello/World", false, 50_ms),
- bind([] { BOOST_FAIL("Unexpected Data"); }),
- bind([] { BOOST_FAIL("Unexpected Nack"); }),
+ std::bind([] { BOOST_FAIL("Unexpected Data"); }),
+ std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
nullptr);
advanceClocks(40_ms);
@@ -201,14 +200,14 @@
auto interest = makeInterest("/Hello/World", false, 50_ms);
face.expressInterest(*interest,
- bind([] { BOOST_FAIL("Unexpected Data"); }),
+ std::bind([] { BOOST_FAIL("Unexpected Data"); }),
[&] (const Interest& i, const lp::Nack& n) {
BOOST_CHECK(i.getName().isPrefixOf(n.getInterest().getName()));
BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
BOOST_CHECK_EQUAL(n.getReason(), lp::NackReason::DUPLICATE);
++nNacks;
},
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
advanceClocks(40_ms);
@@ -226,15 +225,15 @@
auto interest = makeInterest("/Hello/World", false, 50_ms, 1);
face.expressInterest(*interest,
- bind([] { BOOST_FAIL("Unexpected Data"); }),
+ std::bind([] { BOOST_FAIL("Unexpected Data"); }),
[&] (const auto&, const auto&) { ++nNacks; },
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
interest->setNonce(2);
face.expressInterest(*interest,
- bind([] { BOOST_FAIL("Unexpected Data"); }),
+ std::bind([] { BOOST_FAIL("Unexpected Data"); }),
[&] (const auto&, const auto&) { ++nNacks; },
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
advanceClocks(40_ms);
@@ -249,9 +248,9 @@
BOOST_AUTO_TEST_CASE(EmptyNackCallback)
{
face.expressInterest(*makeInterest("/Hello/World"),
- bind([] { BOOST_FAIL("Unexpected Data"); }),
+ std::bind([] { BOOST_FAIL("Unexpected Data"); }),
nullptr,
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
advanceClocks(1_ms);
BOOST_CHECK_NO_THROW(do {
@@ -294,9 +293,9 @@
BOOST_AUTO_TEST_CASE(Handle)
{
auto hdl = face.expressInterest(*makeInterest("/Hello/World", true, 50_ms),
- bind([] { BOOST_FAIL("Unexpected data"); }),
- bind([] { BOOST_FAIL("Unexpected nack"); }),
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([] { BOOST_FAIL("Unexpected data"); }),
+ std::bind([] { BOOST_FAIL("Unexpected nack"); }),
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
advanceClocks(1_ms);
hdl.cancel();
advanceClocks(1_ms);
@@ -306,9 +305,9 @@
// cancel after destructing face
auto face2 = make_unique<DummyClientFace>(m_io, m_keyChain);
auto hdl2 = face2->expressInterest(*makeInterest("/Hello/World", true, 50_ms),
- bind([] { BOOST_FAIL("Unexpected data"); }),
- bind([] { BOOST_FAIL("Unexpected nack"); }),
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([] { BOOST_FAIL("Unexpected data"); }),
+ std::bind([] { BOOST_FAIL("Unexpected nack"); }),
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
advanceClocks(1_ms);
face2.reset();
advanceClocks(1_ms);
@@ -324,14 +323,14 @@
BOOST_AUTO_TEST_CASE(RemoveAllPendingInterests)
{
face.expressInterest(*makeInterest("/Hello/World/0", false, 50_ms),
- bind([] { BOOST_FAIL("Unexpected data"); }),
- bind([] { BOOST_FAIL("Unexpected nack"); }),
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([] { BOOST_FAIL("Unexpected data"); }),
+ std::bind([] { BOOST_FAIL("Unexpected nack"); }),
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
face.expressInterest(*makeInterest("/Hello/World/1", false, 50_ms),
- bind([] { BOOST_FAIL("Unexpected data"); }),
- bind([] { BOOST_FAIL("Unexpected nack"); }),
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([] { BOOST_FAIL("Unexpected data"); }),
+ std::bind([] { BOOST_FAIL("Unexpected nack"); }),
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
advanceClocks(10_ms);
@@ -380,12 +379,12 @@
});
// second InterestFilter disallows loopback and should not receive Interest
face.setInterestFilter(InterestFilter("/").allowLoopback(false),
- bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
+ std::bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
face.expressInterest(*makeInterest("/A", true),
- bind([&] { hasData = true; }),
- bind([] { BOOST_FAIL("Unexpected nack"); }),
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([&] { hasData = true; }),
+ std::bind([] { BOOST_FAIL("Unexpected nack"); }),
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
advanceClocks(1_ms);
BOOST_CHECK_EQUAL(hasInterest1, true); // Interest looped back
BOOST_CHECK_EQUAL(face.sentInterests.size(), 1); // Interest sent to forwarder
@@ -401,12 +400,12 @@
{
bool hasInterest1 = false;
// register two Interest destinations
- face.setInterestFilter("/", bind([&] {
+ face.setInterestFilter("/", std::bind([&] {
hasInterest1 = true;
// sending Data right away from the first destination, don't care whether Interest goes to second destination
face.put(*makeData("/A/B"));
}));
- face.setInterestFilter("/", bind([]{}));
+ face.setInterestFilter("/", std::bind([]{}));
advanceClocks(10_ms);
face.receive(*makeInterest("/A", true));
@@ -421,7 +420,7 @@
BOOST_AUTO_TEST_CASE(PutNack)
{
- face.setInterestFilter("/", bind([]{})); // register one Interest destination so that face can accept Nacks
+ face.setInterestFilter("/", std::bind([]{})); // register one Interest destination so that face can accept Nacks
advanceClocks(10_ms);
BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
@@ -461,7 +460,7 @@
// sending Nack right away from the first destination, Interest should still go to second destination
face.put(makeNack(interest, lp::NackReason::CONGESTION));
});
- face.setInterestFilter("/", bind([&] { hasInterest2 = true; }));
+ face.setInterestFilter("/", std::bind([&] { hasInterest2 = true; }));
advanceClocks(10_ms);
auto interest = makeInterest("/A", false, std::nullopt, 14333271);
@@ -493,16 +492,16 @@
});
// second InterestFilter disallows loopback and should not receive Interest
face.setInterestFilter(InterestFilter("/").allowLoopback(false),
- bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
+ std::bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
auto interest = makeInterest("/A", false, std::nullopt, 28395852);
face.expressInterest(*interest,
- bind([] { BOOST_FAIL("Unexpected data"); }),
+ std::bind([] { BOOST_FAIL("Unexpected data"); }),
[&] (const Interest&, const lp::Nack& nack) {
hasNack = true;
BOOST_CHECK_EQUAL(nack.getReason(), lp::NackReason::CONGESTION);
},
- bind([] { BOOST_FAIL("Unexpected timeout"); }));
+ std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
advanceClocks(1_ms);
BOOST_CHECK_EQUAL(hasInterest1, true); // Interest looped back
BOOST_CHECK_EQUAL(face.sentInterests.size(), 1); // Interest sent to forwarder
@@ -557,7 +556,7 @@
// cancel after destructing face
auto face2 = make_unique<DummyClientFace>(m_io, m_keyChain);
hdl = face2->registerPrefix("/Hello/World/2", nullptr,
- bind([] { BOOST_FAIL("Unexpected registerPrefix failure"); }));
+ std::bind([] { BOOST_FAIL("Unexpected registerPrefix failure"); }));
advanceClocks(1_ms);
face2.reset();
advanceClocks(1_ms);
@@ -567,7 +566,7 @@
// unregister after destructing face
auto face3 = make_unique<DummyClientFace>(m_io, m_keyChain);
hdl = face3->registerPrefix("/Hello/World/3", nullptr,
- bind([] { BOOST_FAIL("Unexpected registerPrefix failure"); }));
+ std::bind([] { BOOST_FAIL("Unexpected registerPrefix failure"); }));
advanceClocks(1_ms);
face3.reset();
advanceClocks(1_ms);
@@ -583,9 +582,9 @@
size_t nInterests = 0;
size_t nRegs = 0;
auto hdl = face.setInterestFilter("/Hello/World",
- bind([&nInterests] { ++nInterests; }),
- bind([&nRegs] { ++nRegs; }),
- bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
+ std::bind([&nInterests] { ++nInterests; }),
+ std::bind([&nRegs] { ++nRegs; }),
+ std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
advanceClocks(25_ms, 4);
BOOST_CHECK_EQUAL(nRegs, 1);
BOOST_CHECK_EQUAL(nInterests, 0);
@@ -627,8 +626,8 @@
{
size_t nInterests = 0;
auto hdl = face.setInterestFilter("/Hello/World",
- bind([&nInterests] { ++nInterests; }),
- bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
+ std::bind([&nInterests] { ++nInterests; }),
+ std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
advanceClocks(25_ms, 4);
BOOST_CHECK_EQUAL(nInterests, 0);
@@ -658,9 +657,9 @@
// don't enable registration reply
size_t nRegFailed = 0;
face.setInterestFilter("/Hello/World",
- bind([] { BOOST_FAIL("Unexpected Interest"); }),
- bind([] { BOOST_FAIL("Unexpected success of setInterestFilter"); }),
- bind([&nRegFailed] { ++nRegFailed; }));
+ std::bind([] { BOOST_FAIL("Unexpected Interest"); }),
+ std::bind([] { BOOST_FAIL("Unexpected success of setInterestFilter"); }),
+ std::bind([&nRegFailed] { ++nRegFailed; }));
advanceClocks(25_ms, 4);
BOOST_CHECK_EQUAL(nRegFailed, 0);
@@ -674,8 +673,8 @@
// don't enable registration reply
size_t nRegFailed = 0;
face.setInterestFilter("/Hello/World",
- bind([] { BOOST_FAIL("Unexpected Interest"); }),
- bind([&nRegFailed] { ++nRegFailed; }));
+ std::bind([] { BOOST_FAIL("Unexpected Interest"); }),
+ std::bind([&nRegFailed] { ++nRegFailed; }));
advanceClocks(25_ms, 4);
BOOST_CHECK_EQUAL(nRegFailed, 0);
@@ -688,21 +687,21 @@
{
size_t nInInterests1 = 0;
face.setInterestFilter("/Hello/World",
- bind([&nInInterests1] { ++nInInterests1; }),
+ std::bind([&nInInterests1] { ++nInInterests1; }),
nullptr,
- bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
+ std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
size_t nInInterests2 = 0;
face.setInterestFilter("/Hello",
- bind([&nInInterests2] { ++nInInterests2; }),
+ std::bind([&nInInterests2] { ++nInInterests2; }),
nullptr,
- bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
+ std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
size_t nInInterests3 = 0;
face.setInterestFilter("/Los/Angeles/Lakers",
- bind([&nInInterests3] { ++nInInterests3; }),
+ std::bind([&nInInterests3] { ++nInInterests3; }),
nullptr,
- bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
+ std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
advanceClocks(25_ms, 4);
@@ -718,9 +717,9 @@
{
size_t nInInterests = 0;
face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
- bind([&nInInterests] { ++nInInterests; }),
+ std::bind([&nInInterests] { ++nInInterests; }),
nullptr,
- bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
+ std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
advanceClocks(25_ms, 4);
@@ -744,7 +743,7 @@
BOOST_FAIL("InterestFilter::Error should have been triggered");
},
nullptr,
- bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
+ std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
advanceClocks(25_ms, 4);
@@ -755,12 +754,12 @@
{
size_t nInInterests = 0;
face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
- bind([&nInInterests] { ++nInInterests; }));
+ std::bind([&nInInterests] { ++nInInterests; }));
size_t nRegSuccesses = 0;
face.registerPrefix("/Hello/World",
- bind([&nRegSuccesses] { ++nRegSuccesses; }),
- bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
+ std::bind([&nRegSuccesses] { ++nRegSuccesses; }),
+ std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
advanceClocks(25_ms, 4);
BOOST_CHECK_EQUAL(nRegSuccesses, 1);
@@ -784,7 +783,7 @@
// Regular Face won't accept incoming packets until something is sent.
int hit = 0;
- face.setInterestFilter(Name("/"), bind([&hit] { ++hit; }));
+ face.setInterestFilter(Name("/"), std::bind([&hit] { ++hit; }));
face.processEvents(time::milliseconds(-1));
face.receive(*makeInterest("/A"));
@@ -796,7 +795,7 @@
BOOST_AUTO_TEST_CASE(Handle)
{
int hit = 0;
- InterestFilterHandle hdl = face.setInterestFilter(Name("/"), bind([&hit] { ++hit; }));
+ InterestFilterHandle hdl = face.setInterestFilter(Name("/"), std::bind([&hit] { ++hit; }));
face.processEvents(-1_ms);
face.receive(*makeInterest("/A"));
@@ -828,8 +827,8 @@
size_t nRegSuccesses = 0;
face.registerPrefix("/Hello/World",
- bind([&nRegSuccesses] { ++nRegSuccesses; }),
- bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
+ std::bind([&nRegSuccesses] { ++nRegSuccesses; }),
+ std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
// io_service::poll() without reset
face.getIoService().poll();
diff --git a/tests/unit/ims/in-memory-storage.t.cpp b/tests/unit/ims/in-memory-storage.t.cpp
index f6c2a40..27caa34 100644
--- a/tests/unit/ims/in-memory-storage.t.cpp
+++ b/tests/unit/ims/in-memory-storage.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -450,7 +450,7 @@
const time::milliseconds& freshWindow = InMemoryStorage::INFINITE_WINDOW)
{
auto data = makeData(name);
- data->setContent(make_span(reinterpret_cast<const uint8_t*>(&id), sizeof(id)));
+ data->setContent({reinterpret_cast<const uint8_t*>(&id), sizeof(id)});
if (modifyData != nullptr) {
modifyData(*data);
diff --git a/tests/unit/interest.t.cpp b/tests/unit/interest.t.cpp
index 684f097..73afe60 100644
--- a/tests/unit/interest.t.cpp
+++ b/tests/unit/interest.t.cpp
@@ -27,6 +27,12 @@
namespace ndn {
namespace tests {
+BOOST_CONCEPT_ASSERT((WireEncodable<Interest>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Interest>));
+BOOST_CONCEPT_ASSERT((WireDecodable<Interest>));
+static_assert(std::is_convertible_v<Interest::Error*, tlv::Error*>,
+ "Interest::Error must inherit from tlv::Error");
+
BOOST_AUTO_TEST_SUITE(TestInterest)
class DisableAutoCheckParametersDigest
diff --git a/tests/unit/key-locator.t.cpp b/tests/unit/key-locator.t.cpp
index d7dfe9f..7a8b636 100644
--- a/tests/unit/key-locator.t.cpp
+++ b/tests/unit/key-locator.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,11 +23,19 @@
#include "ndn-cxx/encoding/block-helpers.hpp"
#include "tests/boost-test.hpp"
+
#include <boost/lexical_cast.hpp>
namespace ndn {
namespace tests {
+BOOST_CONCEPT_ASSERT((boost::EqualityComparable<KeyLocator>));
+BOOST_CONCEPT_ASSERT((WireEncodable<KeyLocator>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<KeyLocator>));
+BOOST_CONCEPT_ASSERT((WireDecodable<KeyLocator>));
+static_assert(std::is_convertible_v<KeyLocator::Error*, tlv::Error*>,
+ "KeyLocator::Error must inherit from tlv::Error");
+
BOOST_AUTO_TEST_SUITE(TestKeyLocator)
BOOST_AUTO_TEST_CASE(TypeNone)
diff --git a/tests/unit/link.t.cpp b/tests/unit/link.t.cpp
index fe4b45c..106541a 100644
--- a/tests/unit/link.t.cpp
+++ b/tests/unit/link.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,6 +26,13 @@
namespace ndn {
namespace tests {
+BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Link>));
+BOOST_CONCEPT_ASSERT((WireEncodable<Link>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Link>));
+BOOST_CONCEPT_ASSERT((WireDecodable<Link>));
+static_assert(std::is_convertible_v<Link::Error*, Data::Error*>,
+ "Link::Error should inherit from Data::Error");
+
BOOST_AUTO_TEST_SUITE(TestLink)
const uint8_t GOOD_LINK[] = {
diff --git a/tests/unit/lp/fields.t.cpp b/tests/unit/lp/fields.t.cpp
new file mode 100644
index 0000000..e828051
--- /dev/null
+++ b/tests/unit/lp/fields.t.cpp
@@ -0,0 +1,45 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2013-2023 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "ndn-cxx/lp/fields.hpp"
+
+namespace ndn {
+namespace lp {
+namespace tests {
+
+BOOST_CONCEPT_ASSERT((Field<FragmentField>));
+BOOST_CONCEPT_ASSERT((Field<SequenceField>));
+BOOST_CONCEPT_ASSERT((Field<FragIndexField>));
+BOOST_CONCEPT_ASSERT((Field<FragCountField>));
+BOOST_CONCEPT_ASSERT((Field<PitTokenField>));
+BOOST_CONCEPT_ASSERT((Field<NackField>));
+BOOST_CONCEPT_ASSERT((Field<IncomingFaceIdField>));
+BOOST_CONCEPT_ASSERT((Field<NextHopFaceIdField>));
+BOOST_CONCEPT_ASSERT((Field<CachePolicyField>));
+BOOST_CONCEPT_ASSERT((Field<CongestionMarkField>));
+BOOST_CONCEPT_ASSERT((Field<AckField>));
+BOOST_CONCEPT_ASSERT((Field<TxSequenceField>));
+BOOST_CONCEPT_ASSERT((Field<NonDiscoveryField>));
+BOOST_CONCEPT_ASSERT((Field<PrefixAnnouncementField>));
+
+} // namespace tests
+} // namespace lp
+} // namespace ndn
diff --git a/tests/unit/lp/pit-token.t.cpp b/tests/unit/lp/pit-token.t.cpp
index 48ef8d6..49d77c1 100644
--- a/tests/unit/lp/pit-token.t.cpp
+++ b/tests/unit/lp/pit-token.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,6 +23,7 @@
#include "ndn-cxx/lp/packet.hpp"
#include "tests/boost-test.hpp"
+
#include <boost/lexical_cast.hpp>
namespace ndn {
diff --git a/tests/unit/meta-info.t.cpp b/tests/unit/meta-info.t.cpp
index 19fa2d3..f909565 100644
--- a/tests/unit/meta-info.t.cpp
+++ b/tests/unit/meta-info.t.cpp
@@ -26,6 +26,12 @@
namespace ndn {
namespace tests {
+BOOST_CONCEPT_ASSERT((WireEncodable<MetaInfo>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<MetaInfo>));
+BOOST_CONCEPT_ASSERT((WireDecodable<MetaInfo>));
+static_assert(std::is_convertible_v<MetaInfo::Error*, tlv::Error*>,
+ "MetaInfo::Error must inherit from tlv::Error");
+
BOOST_AUTO_TEST_SUITE(TestMetaInfo)
BOOST_AUTO_TEST_CASE(EncodeDecode)
diff --git a/tests/unit/mgmt/control-response.t.cpp b/tests/unit/mgmt/control-response.t.cpp
index c23f7f0..1dd69b1 100644
--- a/tests/unit/mgmt/control-response.t.cpp
+++ b/tests/unit/mgmt/control-response.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,6 +20,7 @@
*/
#include "ndn-cxx/mgmt/control-response.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
@@ -27,6 +28,11 @@
namespace mgmt {
namespace tests {
+BOOST_CONCEPT_ASSERT((WireEncodable<ControlResponse>));
+BOOST_CONCEPT_ASSERT((WireDecodable<ControlResponse>));
+static_assert(std::is_convertible_v<ControlResponse::Error*, tlv::Error*>,
+ "ControlResponse::Error must inherit from tlv::Error");
+
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(TestControlResponse)
diff --git a/tests/unit/mgmt/dispatcher.t.cpp b/tests/unit/mgmt/dispatcher.t.cpp
index a4897a9..9b01628 100644
--- a/tests/unit/mgmt/dispatcher.t.cpp
+++ b/tests/unit/mgmt/dispatcher.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -31,7 +31,6 @@
namespace tests {
using namespace ndn::tests;
-using std::bind;
class DispatcherFixture : public IoKeyChainFixture
{
@@ -98,25 +97,25 @@
{
BOOST_CHECK_NO_THROW(dispatcher
.addControlCommand<VoidParameters>("test/1", makeAcceptAllAuthorization(),
- bind([] { return true; }),
- bind([]{})));
+ std::bind([] { return true; }),
+ std::bind([]{})));
BOOST_CHECK_NO_THROW(dispatcher
.addControlCommand<VoidParameters>("test/2", makeAcceptAllAuthorization(),
- bind([] { return true; }),
- bind([]{})));
+ std::bind([] { return true; }),
+ std::bind([]{})));
BOOST_CHECK_THROW(dispatcher
.addControlCommand<VoidParameters>("test", makeAcceptAllAuthorization(),
- bind([] { return true; }),
- bind([]{})),
+ std::bind([] { return true; }),
+ std::bind([]{})),
std::out_of_range);
BOOST_CHECK_NO_THROW(dispatcher.addStatusDataset("status/1",
- makeAcceptAllAuthorization(), bind([]{})));
+ makeAcceptAllAuthorization(), std::bind([]{})));
BOOST_CHECK_NO_THROW(dispatcher.addStatusDataset("status/2",
- makeAcceptAllAuthorization(), bind([]{})));
+ makeAcceptAllAuthorization(), std::bind([]{})));
BOOST_CHECK_THROW(dispatcher.addStatusDataset("status",
- makeAcceptAllAuthorization(), bind([]{})),
+ makeAcceptAllAuthorization(), std::bind([]{})),
std::out_of_range);
BOOST_CHECK_NO_THROW(dispatcher.addNotificationStream("stream/1"));
@@ -130,12 +129,12 @@
BOOST_CHECK_THROW(dispatcher
.addControlCommand<VoidParameters>("test/3", makeAcceptAllAuthorization(),
- bind([] { return true; }),
- bind([]{})),
+ std::bind([] { return true; }),
+ std::bind([]{})),
std::domain_error);
BOOST_CHECK_THROW(dispatcher.addStatusDataset("status/3",
- makeAcceptAllAuthorization(), bind([]{})),
+ makeAcceptAllAuthorization(), std::bind([]{})),
std::domain_error);
BOOST_CHECK_THROW(dispatcher.addNotificationStream("stream/3"), std::domain_error);
@@ -146,13 +145,13 @@
std::map<std::string, size_t> nCallbackCalled;
dispatcher
.addControlCommand<VoidParameters>("test/1", makeAcceptAllAuthorization(),
- bind([] { return true; }),
- bind([&nCallbackCalled] { ++nCallbackCalled["test/1"]; }));
+ std::bind([] { return true; }),
+ std::bind([&nCallbackCalled] { ++nCallbackCalled["test/1"]; }));
dispatcher
.addControlCommand<VoidParameters>("test/2", makeAcceptAllAuthorization(),
- bind([] { return true; }),
- bind([&nCallbackCalled] { ++nCallbackCalled["test/2"]; }));
+ std::bind([] { return true; }),
+ std::bind([&nCallbackCalled] { ++nCallbackCalled["test/2"]; }));
face.receive(*makeInterest("/root/1/test/1/%80%00"));
advanceClocks(1_ms);
@@ -207,8 +206,8 @@
dispatcher
.addControlCommand<VoidParameters>("test",
makeTestAuthorization(),
- bind([] { return true; }),
- bind([&nCallbackCalled] { ++nCallbackCalled; }));
+ std::bind([] { return true; }),
+ std::bind([&nCallbackCalled] { ++nCallbackCalled; }));
dispatcher.addTopPrefix("/root");
advanceClocks(1_ms);
@@ -281,7 +280,7 @@
size_t nCallbackCalled = 0;
dispatcher.addControlCommand<StatefulParameters>("test", authorization, validateParameters,
- bind([&nCallbackCalled] { ++nCallbackCalled; }));
+ std::bind([&nCallbackCalled] { ++nCallbackCalled; }));
dispatcher.addTopPrefix("/root");
advanceClocks(1_ms);
diff --git a/tests/unit/mgmt/nfd/channel-status.t.cpp b/tests/unit/mgmt/nfd/channel-status.t.cpp
index dc29def..8036d0d 100644
--- a/tests/unit/mgmt/nfd/channel-status.t.cpp
+++ b/tests/unit/mgmt/nfd/channel-status.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,6 +20,7 @@
*/
#include "ndn-cxx/mgmt/nfd/channel-status.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
@@ -29,6 +30,8 @@
namespace nfd {
namespace tests {
+BOOST_CONCEPT_ASSERT((StatusDatasetItem<ChannelStatus>));
+
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
BOOST_AUTO_TEST_SUITE(TestChannelStatus)
diff --git a/tests/unit/mgmt/nfd/control-parameters.t.cpp b/tests/unit/mgmt/nfd/control-parameters.t.cpp
index b098529..4866620 100644
--- a/tests/unit/mgmt/nfd/control-parameters.t.cpp
+++ b/tests/unit/mgmt/nfd/control-parameters.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,6 +20,7 @@
*/
#include "ndn-cxx/mgmt/nfd/control-parameters.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
@@ -27,6 +28,11 @@
namespace nfd {
namespace tests {
+BOOST_CONCEPT_ASSERT((WireEncodable<ControlParameters>));
+BOOST_CONCEPT_ASSERT((WireDecodable<ControlParameters>));
+static_assert(std::is_convertible_v<ControlParameters::Error*, tlv::Error*>,
+ "ControlParameters::Error must inherit from tlv::Error");
+
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
BOOST_AUTO_TEST_SUITE(TestControlParameters)
diff --git a/tests/unit/mgmt/nfd/cs-info.t.cpp b/tests/unit/mgmt/nfd/cs-info.t.cpp
index 3bc5f7b..70d8a20 100644
--- a/tests/unit/mgmt/nfd/cs-info.t.cpp
+++ b/tests/unit/mgmt/nfd/cs-info.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,14 +20,18 @@
*/
#include "ndn-cxx/mgmt/nfd/cs-info.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
+
#include <boost/lexical_cast.hpp>
namespace ndn {
namespace nfd {
namespace tests {
+BOOST_CONCEPT_ASSERT((StatusDatasetItem<CsInfo>));
+
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
BOOST_AUTO_TEST_SUITE(TestCsInfo)
diff --git a/tests/unit/mgmt/nfd/face-event-notification.t.cpp b/tests/unit/mgmt/nfd/face-event-notification.t.cpp
index f1dfc38..97b3000 100644
--- a/tests/unit/mgmt/nfd/face-event-notification.t.cpp
+++ b/tests/unit/mgmt/nfd/face-event-notification.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,6 +20,7 @@
*/
#include "ndn-cxx/mgmt/nfd/face-event-notification.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
@@ -29,6 +30,8 @@
namespace nfd {
namespace tests {
+BOOST_CONCEPT_ASSERT((NotificationStreamItem<FaceEventNotification>));
+
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
BOOST_AUTO_TEST_SUITE(TestFaceEventNotification)
diff --git a/tests/unit/mgmt/nfd/face-query-filter.t.cpp b/tests/unit/mgmt/nfd/face-query-filter.t.cpp
index e46d6c1..1f83f82 100644
--- a/tests/unit/mgmt/nfd/face-query-filter.t.cpp
+++ b/tests/unit/mgmt/nfd/face-query-filter.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,6 +20,7 @@
*/
#include "ndn-cxx/mgmt/nfd/face-query-filter.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
@@ -29,6 +30,12 @@
namespace nfd {
namespace tests {
+BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceQueryFilter>));
+BOOST_CONCEPT_ASSERT((WireEncodable<FaceQueryFilter>));
+BOOST_CONCEPT_ASSERT((WireDecodable<FaceQueryFilter>));
+static_assert(std::is_convertible_v<FaceQueryFilter::Error*, tlv::Error*>,
+ "FaceQueryFilter::Error must inherit from tlv::Error");
+
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
BOOST_AUTO_TEST_SUITE(TestFaceQueryFilter)
diff --git a/tests/unit/mgmt/nfd/face-status.t.cpp b/tests/unit/mgmt/nfd/face-status.t.cpp
index 405bf2c..275acf2 100644
--- a/tests/unit/mgmt/nfd/face-status.t.cpp
+++ b/tests/unit/mgmt/nfd/face-status.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,6 +20,7 @@
*/
#include "ndn-cxx/mgmt/nfd/face-status.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
@@ -29,6 +30,8 @@
namespace nfd {
namespace tests {
+BOOST_CONCEPT_ASSERT((StatusDatasetItem<FaceStatus>));
+
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
BOOST_AUTO_TEST_SUITE(TestFaceStatus)
diff --git a/tests/unit/mgmt/nfd/fib-entry.t.cpp b/tests/unit/mgmt/nfd/fib-entry.t.cpp
index ff5d21b..81f94e5 100644
--- a/tests/unit/mgmt/nfd/fib-entry.t.cpp
+++ b/tests/unit/mgmt/nfd/fib-entry.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,14 +20,19 @@
*/
#include "ndn-cxx/mgmt/nfd/fib-entry.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
+
#include <boost/lexical_cast.hpp>
namespace ndn {
namespace nfd {
namespace tests {
+BOOST_CONCEPT_ASSERT((StatusDatasetItem<NextHopRecord>));
+BOOST_CONCEPT_ASSERT((StatusDatasetItem<FibEntry>));
+
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
BOOST_AUTO_TEST_SUITE(TestFibEntry)
diff --git a/tests/unit/mgmt/nfd/forwarder-status.t.cpp b/tests/unit/mgmt/nfd/forwarder-status.t.cpp
index b4eb339..6492e55 100644
--- a/tests/unit/mgmt/nfd/forwarder-status.t.cpp
+++ b/tests/unit/mgmt/nfd/forwarder-status.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,6 +20,7 @@
*/
#include "ndn-cxx/mgmt/nfd/forwarder-status.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
@@ -29,6 +30,8 @@
namespace nfd {
namespace tests {
+BOOST_CONCEPT_ASSERT((StatusDatasetItem<ForwarderStatus>));
+
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
BOOST_AUTO_TEST_SUITE(TestForwarderStatus)
diff --git a/tests/unit/mgmt/nfd/rib-entry.t.cpp b/tests/unit/mgmt/nfd/rib-entry.t.cpp
index 950a196..3479c01 100644
--- a/tests/unit/mgmt/nfd/rib-entry.t.cpp
+++ b/tests/unit/mgmt/nfd/rib-entry.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,14 +20,19 @@
*/
#include "ndn-cxx/mgmt/nfd/rib-entry.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
+
#include <boost/lexical_cast.hpp>
namespace ndn {
namespace nfd {
namespace tests {
+BOOST_CONCEPT_ASSERT((StatusDatasetItem<Route>));
+BOOST_CONCEPT_ASSERT((StatusDatasetItem<RibEntry>));
+
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
BOOST_AUTO_TEST_SUITE(TestRibEntry)
diff --git a/tests/unit/mgmt/nfd/strategy-choice.t.cpp b/tests/unit/mgmt/nfd/strategy-choice.t.cpp
index 94c30e8..92f271c 100644
--- a/tests/unit/mgmt/nfd/strategy-choice.t.cpp
+++ b/tests/unit/mgmt/nfd/strategy-choice.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,6 +20,7 @@
*/
#include "ndn-cxx/mgmt/nfd/strategy-choice.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
@@ -29,6 +30,8 @@
namespace nfd {
namespace tests {
+BOOST_CONCEPT_ASSERT((StatusDatasetItem<StrategyChoice>));
+
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_AUTO_TEST_SUITE(Nfd)
BOOST_AUTO_TEST_SUITE(TestStrategyChoice)
diff --git a/tests/unit/name-component.t.cpp b/tests/unit/name-component.t.cpp
index bd0a553..a35f980 100644
--- a/tests/unit/name-component.t.cpp
+++ b/tests/unit/name-component.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -34,6 +34,13 @@
namespace name {
namespace tests {
+BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Component>));
+BOOST_CONCEPT_ASSERT((WireEncodable<Component>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Component>));
+BOOST_CONCEPT_ASSERT((WireDecodable<Component>));
+static_assert(std::is_convertible_v<Component::Error*, tlv::Error*>,
+ "name::Component::Error must inherit from tlv::Error");
+
BOOST_AUTO_TEST_SUITE(TestNameComponent)
BOOST_AUTO_TEST_SUITE(Decode)
diff --git a/tests/unit/name.t.cpp b/tests/unit/name.t.cpp
index cfe13e0..2e107f5 100644
--- a/tests/unit/name.t.cpp
+++ b/tests/unit/name.t.cpp
@@ -24,6 +24,7 @@
#include "tests/boost-test.hpp"
#include <unordered_map>
+#include <boost/range/concepts.hpp>
namespace ndn {
namespace tests {
@@ -31,6 +32,18 @@
using Component = name::Component;
using UriFormat = name::UriFormat;
+BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Name>));
+BOOST_CONCEPT_ASSERT((WireEncodable<Name>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Name>));
+BOOST_CONCEPT_ASSERT((WireDecodable<Name>));
+BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<Name::iterator>));
+BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<Name::const_iterator>));
+BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<Name::reverse_iterator>));
+BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<Name::const_reverse_iterator>));
+BOOST_CONCEPT_ASSERT((boost::RandomAccessRangeConcept<Name>));
+static_assert(std::is_convertible_v<Name::Error*, tlv::Error*>,
+ "Name::Error must inherit from tlv::Error");
+
BOOST_AUTO_TEST_SUITE(TestName)
// ---- encoding, decoding, and URI ----
diff --git a/tests/unit/net/face-uri.t.cpp b/tests/unit/net/face-uri.t.cpp
index 19cf24c..d21d70f 100644
--- a/tests/unit/net/face-uri.t.cpp
+++ b/tests/unit/net/face-uri.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California,
+ * Copyright (c) 2013-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -32,9 +32,13 @@
#include "tests/boost-test.hpp"
#include "tests/unit/net/network-configuration-detector.hpp"
+#include <boost/concept_check.hpp>
+
namespace ndn {
namespace tests {
+BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceUri>));
+
BOOST_AUTO_TEST_SUITE(Net)
BOOST_AUTO_TEST_SUITE(TestFaceUri)
diff --git a/tests/unit/security/additional-description.t.cpp b/tests/unit/security/additional-description.t.cpp
index 2779816..82dd606 100644
--- a/tests/unit/security/additional-description.t.cpp
+++ b/tests/unit/security/additional-description.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,6 +20,7 @@
*/
#include "ndn-cxx/security/additional-description.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
@@ -27,6 +28,13 @@
namespace security {
namespace tests {
+BOOST_CONCEPT_ASSERT((boost::EqualityComparable<AdditionalDescription>));
+BOOST_CONCEPT_ASSERT((WireEncodable<AdditionalDescription>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<AdditionalDescription>));
+BOOST_CONCEPT_ASSERT((WireDecodable<AdditionalDescription>));
+static_assert(std::is_convertible_v<AdditionalDescription::Error*, tlv::Error*>,
+ "AdditionalDescription::Error must inherit from tlv::Error");
+
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestAdditionalDescription)
diff --git a/tests/unit/security/certificate.t.cpp b/tests/unit/security/certificate.t.cpp
index 37243d6..44ae731 100644
--- a/tests/unit/security/certificate.t.cpp
+++ b/tests/unit/security/certificate.t.cpp
@@ -37,6 +37,11 @@
using namespace ndn::tests;
+BOOST_CONCEPT_ASSERT((WireEncodable<Certificate>));
+BOOST_CONCEPT_ASSERT((WireDecodable<Certificate>));
+static_assert(std::is_convertible_v<Certificate::Error*, Data::Error*>,
+ "Certificate::Error must inherit from Data::Error");
+
BOOST_AUTO_TEST_SUITE(Security)
BOOST_FIXTURE_TEST_SUITE(TestCertificate, ClockFixture)
diff --git a/tests/unit/security/pib/certificate-container.t.cpp b/tests/unit/security/pib/certificate-container.t.cpp
index 55b013e..b1d4343 100644
--- a/tests/unit/security/pib/certificate-container.t.cpp
+++ b/tests/unit/security/pib/certificate-container.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -21,6 +21,7 @@
#include "ndn-cxx/security/pib/certificate-container.hpp"
#include "ndn-cxx/security/pib/impl/pib-memory.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
@@ -30,6 +31,8 @@
namespace pib {
namespace tests {
+NDN_CXX_ASSERT_FORWARD_ITERATOR(CertificateContainer::const_iterator);
+
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestCertificateContainer, PibDataFixture)
diff --git a/tests/unit/security/pib/identity-container.t.cpp b/tests/unit/security/pib/identity-container.t.cpp
index 79daace..ea97da0 100644
--- a/tests/unit/security/pib/identity-container.t.cpp
+++ b/tests/unit/security/pib/identity-container.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -21,6 +21,7 @@
#include "ndn-cxx/security/pib/identity-container.hpp"
#include "ndn-cxx/security/pib/impl/pib-memory.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
@@ -30,6 +31,8 @@
namespace pib {
namespace tests {
+NDN_CXX_ASSERT_FORWARD_ITERATOR(IdentityContainer::const_iterator);
+
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestIdentityContainer, PibDataFixture)
diff --git a/tests/unit/security/pib/key-container.t.cpp b/tests/unit/security/pib/key-container.t.cpp
index a7d29ef..b126bc2 100644
--- a/tests/unit/security/pib/key-container.t.cpp
+++ b/tests/unit/security/pib/key-container.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -21,6 +21,7 @@
#include "ndn-cxx/security/pib/key-container.hpp"
#include "ndn-cxx/security/pib/impl/pib-memory.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
#include "tests/unit/security/pib/pib-data-fixture.hpp"
@@ -30,6 +31,8 @@
namespace pib {
namespace tests {
+NDN_CXX_ASSERT_FORWARD_ITERATOR(KeyContainer::const_iterator);
+
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Pib)
BOOST_FIXTURE_TEST_SUITE(TestKeyContainer, PibDataFixture)
diff --git a/tests/unit/security/safe-bag.t.cpp b/tests/unit/security/safe-bag.t.cpp
index 5d24112..ade7f69 100644
--- a/tests/unit/security/safe-bag.t.cpp
+++ b/tests/unit/security/safe-bag.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -29,6 +29,9 @@
namespace security {
namespace tests {
+BOOST_CONCEPT_ASSERT((WireEncodable<SafeBag>));
+BOOST_CONCEPT_ASSERT((WireDecodable<SafeBag>));
+
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestSafeBag)
diff --git a/tests/unit/security/validator-null.t.cpp b/tests/unit/security/validator-null.t.cpp
index 8fc5a5e..5ad9be5 100644
--- a/tests/unit/security/validator-null.t.cpp
+++ b/tests/unit/security/validator-null.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-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,8 +28,6 @@
namespace security {
namespace tests {
-using std::bind;
-
BOOST_AUTO_TEST_SUITE(Security)
BOOST_FIXTURE_TEST_SUITE(TestValidatorNull, ndn::tests::KeyChainFixture)
@@ -41,8 +39,8 @@
ValidatorNull validator;
validator.validate(data,
- bind([] { BOOST_CHECK_MESSAGE(true, "Validation should succeed"); }),
- bind([] { BOOST_CHECK_MESSAGE(false, "Validation should not have failed"); }));
+ std::bind([] { BOOST_CHECK_MESSAGE(true, "Validation should succeed"); }),
+ std::bind([] { BOOST_CHECK_MESSAGE(false, "Validation should not have failed"); }));
}
BOOST_AUTO_TEST_CASE(ValidateInterest)
@@ -53,8 +51,8 @@
ValidatorNull validator;
validator.validate(interest,
- bind([] { BOOST_CHECK_MESSAGE(true, "Validation should succeed"); }),
- bind([] { BOOST_CHECK_MESSAGE(false, "Validation should not have failed"); }));
+ std::bind([] { BOOST_CHECK_MESSAGE(true, "Validation should succeed"); }),
+ std::bind([] { BOOST_CHECK_MESSAGE(false, "Validation should not have failed"); }));
}
BOOST_AUTO_TEST_SUITE_END() // TestValidatorNull
diff --git a/tests/unit/security/validity-period.t.cpp b/tests/unit/security/validity-period.t.cpp
index ff0089f..dbcd47f 100644
--- a/tests/unit/security/validity-period.t.cpp
+++ b/tests/unit/security/validity-period.t.cpp
@@ -20,6 +20,7 @@
*/
#include "ndn-cxx/security/validity-period.hpp"
+#include "ndn-cxx/util/concepts.hpp"
#include "tests/boost-test.hpp"
#include "tests/unit/clock-fixture.hpp"
@@ -32,6 +33,13 @@
using namespace ndn::tests;
+BOOST_CONCEPT_ASSERT((boost::EqualityComparable<ValidityPeriod>));
+BOOST_CONCEPT_ASSERT((WireEncodable<ValidityPeriod>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<ValidityPeriod>));
+BOOST_CONCEPT_ASSERT((WireDecodable<ValidityPeriod>));
+static_assert(std::is_convertible_v<ValidityPeriod::Error*, tlv::Error*>,
+ "ValidityPeriod::Error must inherit from tlv::Error");
+
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(TestValidityPeriod)
diff --git a/tests/unit/signature-info.t.cpp b/tests/unit/signature-info.t.cpp
index 6924a07..d538217 100644
--- a/tests/unit/signature-info.t.cpp
+++ b/tests/unit/signature-info.t.cpp
@@ -28,6 +28,13 @@
namespace ndn {
namespace tests {
+BOOST_CONCEPT_ASSERT((boost::EqualityComparable<SignatureInfo>));
+BOOST_CONCEPT_ASSERT((WireEncodable<SignatureInfo>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<SignatureInfo>));
+BOOST_CONCEPT_ASSERT((WireDecodable<SignatureInfo>));
+static_assert(std::is_convertible_v<SignatureInfo::Error*, tlv::Error*>,
+ "SignatureInfo::Error must inherit from tlv::Error");
+
BOOST_AUTO_TEST_SUITE(TestSignatureInfo)
BOOST_AUTO_TEST_CASE(Constructor)
diff --git a/tests/unit/util/segment-fetcher.t.cpp b/tests/unit/util/segment-fetcher.t.cpp
index cd74372..4abe243 100644
--- a/tests/unit/util/segment-fetcher.t.cpp
+++ b/tests/unit/util/segment-fetcher.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -36,7 +36,6 @@
namespace tests {
using namespace ndn::tests;
-using std::bind;
class SegmentFetcherFixture : public IoKeyChainFixture
{
@@ -93,10 +92,10 @@
void
connectSignals(const shared_ptr<SegmentFetcher>& fetcher)
{
- fetcher->onInOrderData.connect(bind(&SegmentFetcherFixture::onInOrderData, this, _1));
- fetcher->onInOrderComplete.connect(bind(&SegmentFetcherFixture::onInOrderComplete, this));
- fetcher->onComplete.connect(bind(&SegmentFetcherFixture::onComplete, this, _1));
- fetcher->onError.connect(bind(&SegmentFetcherFixture::onError, this, _1));
+ fetcher->onInOrderData.connect(std::bind(&SegmentFetcherFixture::onInOrderData, this, _1));
+ fetcher->onInOrderComplete.connect(std::bind(&SegmentFetcherFixture::onInOrderComplete, this));
+ fetcher->onComplete.connect(std::bind(&SegmentFetcherFixture::onComplete, this, _1));
+ fetcher->onError.connect(std::bind(&SegmentFetcherFixture::onError, this, _1));
fetcher->afterSegmentReceived.connect([this] (const auto&) { ++this->nAfterSegmentReceived; });
fetcher->afterSegmentValidated.connect([this] (const auto &) { ++this->nAfterSegmentValidated; });
@@ -190,7 +189,7 @@
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
acceptValidator, options);
connectSignals(fetcher);
- fetcher->afterSegmentTimedOut.connect(bind([&nAfterSegmentTimedOut] { ++nAfterSegmentTimedOut; }));
+ fetcher->afterSegmentTimedOut.connect([&nAfterSegmentTimedOut] { ++nAfterSegmentTimedOut; });
advanceClocks(1_ms);
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
@@ -310,7 +309,7 @@
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
acceptValidator);
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
connectSignals(fetcher);
face.processEvents(1_s);
@@ -333,7 +332,7 @@
sendNackInsteadOfDropping = false;
auto fetcher = SegmentFetcher::start(face, Interest("/hello/world"), acceptValidator, options);
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
connectSignals(fetcher);
face.processEvents(1_s);
@@ -358,7 +357,7 @@
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
acceptValidator);
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
connectSignals(fetcher);
face.processEvents(1_s);
@@ -382,7 +381,7 @@
defaultSegmentToSend = 47;
auto fetcher = SegmentFetcher::start(face, Interest("/hello/world"), acceptValidator, options);
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
connectSignals(fetcher);
face.processEvents(1_s);
@@ -627,7 +626,7 @@
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
acceptValidator);
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
connectSignals(fetcher);
face.processEvents(1_s);
@@ -652,7 +651,7 @@
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
acceptValidator);
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
connectSignals(fetcher);
face.processEvents(1_s);
@@ -672,7 +671,7 @@
segmentsToDropOrNack.push(0);
sendNackInsteadOfDropping = true;
nackReason = lp::NackReason::NO_ROUTE;
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
acceptValidator);
diff --git a/tests/unit/util/signal.t.cpp b/tests/unit/util/signal.t.cpp
index 2c53336..b3640f9 100644
--- a/tests/unit/util/signal.t.cpp
+++ b/tests/unit/util/signal.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,6 +23,8 @@
#include "tests/boost-test.hpp"
+#include <boost/concept_check.hpp>
+
namespace ndn {
namespace util {
namespace signal {
@@ -117,19 +119,16 @@
class RefObject
{
public:
- RefObject()
- {
- }
+ RefObject() = default;
- RefObject(const RefObject& other)
+ RefObject(const RefObject&)
{
++s_copyCount;
}
public:
- static int s_copyCount;
+ static inline int s_copyCount = 0;
};
-int RefObject::s_copyCount = 0;
// Signal passes arguments by reference,
// but it also allows a handler that accept arguments by value
@@ -446,6 +445,8 @@
BOOST_AUTO_TEST_CASE(ConnectionEquality)
{
+ BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Connection>));
+
SignalOwner0 so;
Connection conn1, conn2;