tests: refactor EthernetFixture
Also, use BOOST_TEST_INFO_SCOPE in a few places.
Change-Id: I113f326207825949ed9d3d22ade0654976d49b76
diff --git a/tests/daemon/face/ethernet-factory.t.cpp b/tests/daemon/face/ethernet-factory.t.cpp
index b6d2516..0ee4562 100644
--- a/tests/daemon/face/ethernet-factory.t.cpp
+++ b/tests/daemon/face/ethernet-factory.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -49,22 +49,20 @@
{
std::set<std::string> uris;
std::transform(netifs.begin(), netifs.end(), std::inserter(uris, uris.end()),
- [] (const auto& netif) {
- return FaceUri::fromDev(netif->getName()).toString();
- });
+ [] (const auto& netif) { return FaceUri::fromDev(netif->getName()).toString(); });
return uris;
}
std::vector<const Face*>
listEtherMcastFaces(ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_MULTI_ACCESS) const
{
- return this->listFacesByScheme("ether", linkType);
+ return listFacesByScheme("ether", linkType);
}
size_t
countEtherMcastFaces(ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_MULTI_ACCESS) const
{
- return this->listEtherMcastFaces(linkType).size();
+ return listEtherMcastFaces(linkType).size();
}
};
@@ -303,10 +301,9 @@
auto etherMcastFaces = this->listEtherMcastFaces();
BOOST_CHECK_EQUAL(etherMcastFaces.size(), netifs.size() - 1);
BOOST_CHECK(std::none_of(etherMcastFaces.begin(), etherMcastFaces.end(),
- [ifname] (const nfd::Face* face) {
- return face->getLocalUri() == FaceUri::fromDev(ifname);
- }
- ));
+ [uri = FaceUri::fromDev(ifname)] (const auto* face) {
+ return face->getLocalUri() == uri;
+ }));
}
BOOST_AUTO_TEST_CASE(Omitted)
@@ -438,6 +435,7 @@
BOOST_AUTO_TEST_CASE(GetChannels)
{
BOOST_CHECK_EQUAL(factory.getChannels().empty(), true);
+
SKIP_IF_ETHERNET_NETIF_COUNT_LT(1);
factory.createChannel(netifs.front(), 1_min);
diff --git a/tests/daemon/face/ethernet-fixture.hpp b/tests/daemon/face/ethernet-fixture.hpp
index dfd5615..45ce00d 100644
--- a/tests/daemon/face/ethernet-fixture.hpp
+++ b/tests/daemon/face/ethernet-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -27,17 +27,12 @@
#define NFD_TESTS_DAEMON_FACE_ETHERNET_FIXTURE_HPP
#include "face/multicast-ethernet-transport.hpp"
-#include "face/unicast-ethernet-transport.hpp"
-#include "tests/daemon/limited-io.hpp"
+#include "tests/daemon/global-io-fixture.hpp"
#include "test-netif.hpp"
namespace nfd::tests {
-using face::EthernetTransport;
-using face::MulticastEthernetTransport;
-using face::UnicastEthernetTransport;
-
/**
* \brief Fixture providing a list of EthernetTransport-capable network interfaces.
*/
@@ -47,79 +42,25 @@
EthernetFixture()
{
for (const auto& netif : collectNetworkInterfaces()) {
- if (!netif->isLoopback() && netif->isUp()) {
+ // similar filtering logic to EthernetFactory::applyMcastConfigToNetif()
+ if (netif->isUp() && !netif->isLoopback() && netif->canMulticast()) {
try {
- MulticastEthernetTransport t(*netif, ethernet::getBroadcastAddress(),
- ndn::nfd::LINK_TYPE_MULTI_ACCESS);
+ face::MulticastEthernetTransport t(*netif, ethernet::getBroadcastAddress(),
+ ndn::nfd::LINK_TYPE_MULTI_ACCESS);
netifs.push_back(netif);
}
- catch (const EthernetTransport::Error&) {
+ catch (const face::EthernetTransport::Error&) {
// ignore
}
}
}
- if (!netifs.empty()) {
- defaultNetif = const_pointer_cast<ndn::net::NetworkInterface>(netifs.front());
- }
- }
-
- /** \brief Returns the first running interface.
- */
- shared_ptr<ndn::net::NetworkInterface>
- getRunningNetif() const
- {
- for (const auto& netif : netifs) {
- if (netif->getState() == ndn::net::InterfaceState::RUNNING) {
- return const_pointer_cast<ndn::net::NetworkInterface>(netif);
- }
- }
-
- return nullptr;
- }
-
- /** \brief Create a UnicastEthernetTransport.
- */
- void
- initializeUnicast(shared_ptr<ndn::net::NetworkInterface> netif = nullptr,
- ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
- ethernet::Address remoteAddr = {0x00, 0x00, 0x5e, 0x00, 0x53, 0x5e})
- {
- if (!netif) {
- netif = defaultNetif;
- }
-
- localEp = netif->getName();
- remoteEp = remoteAddr;
- transport = make_unique<UnicastEthernetTransport>(*netif, remoteEp, persistency, 2_s);
- }
-
- /** \brief Create a MulticastEthernetTransport.
- */
- void
- initializeMulticast(shared_ptr<ndn::net::NetworkInterface> netif = nullptr,
- ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_MULTI_ACCESS,
- ethernet::Address mcastGroup = {0x01, 0x00, 0x5e, 0x90, 0x10, 0x5e})
- {
- if (!netif) {
- netif = defaultNetif;
- }
-
- localEp = netif->getName();
- remoteEp = mcastGroup;
- transport = make_unique<MulticastEthernetTransport>(*netif, remoteEp, linkType);
}
protected:
- LimitedIo limitedIo;
-
- /** \brief EthernetTransport-capable network interfaces.
+ /**
+ * \brief EthernetTransport-capable network interfaces.
*/
std::vector<shared_ptr<const ndn::net::NetworkInterface>> netifs;
-
- shared_ptr<ndn::net::NetworkInterface> defaultNetif;
- unique_ptr<EthernetTransport> transport;
- std::string localEp;
- ethernet::Address remoteEp;
};
} // namespace nfd::tests
@@ -133,13 +74,4 @@
} \
} while (false)
-#define SKIP_IF_NO_RUNNING_ETHERNET_NETIF() \
- do { \
- if (!this->getRunningNetif()) { \
- BOOST_WARN_MESSAGE(false, "skipping assertions that require a running " \
- "EthernetTransport-capable network interface"); \
- return; \
- } \
- } while (false)
-
#endif // NFD_TESTS_DAEMON_FACE_ETHERNET_FIXTURE_HPP
diff --git a/tests/daemon/face/ethernet-transport-fixture.hpp b/tests/daemon/face/ethernet-transport-fixture.hpp
new file mode 100644
index 0000000..ab73795
--- /dev/null
+++ b/tests/daemon/face/ethernet-transport-fixture.hpp
@@ -0,0 +1,115 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2023, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_TESTS_DAEMON_FACE_ETHERNET_TRANSPORT_FIXTURE_HPP
+#define NFD_TESTS_DAEMON_FACE_ETHERNET_TRANSPORT_FIXTURE_HPP
+
+#include "face/multicast-ethernet-transport.hpp"
+#include "face/unicast-ethernet-transport.hpp"
+
+#include "tests/daemon/limited-io.hpp"
+#include "ethernet-fixture.hpp"
+
+namespace nfd::tests {
+
+class EthernetTransportFixture : public EthernetFixture
+{
+protected:
+ EthernetTransportFixture()
+ {
+ if (!netifs.empty()) {
+ defaultNetif = const_pointer_cast<ndn::net::NetworkInterface>(netifs.front());
+ }
+ }
+
+ /**
+ * \brief Returns the first running interface.
+ */
+ shared_ptr<ndn::net::NetworkInterface>
+ getRunningNetif() const
+ {
+ for (const auto& netif : netifs) {
+ if (netif->getState() == ndn::net::InterfaceState::RUNNING) {
+ return const_pointer_cast<ndn::net::NetworkInterface>(netif);
+ }
+ }
+
+ return nullptr;
+ }
+
+ /**
+ * \brief Create a UnicastEthernetTransport.
+ */
+ void
+ initializeUnicast(shared_ptr<ndn::net::NetworkInterface> netif = nullptr,
+ ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+ ethernet::Address remoteAddr = {0x00, 0x00, 0x5e, 0x00, 0x53, 0x5e})
+ {
+ if (!netif) {
+ netif = defaultNetif;
+ }
+
+ localEp = netif->getName();
+ remoteEp = remoteAddr;
+ transport = make_unique<face::UnicastEthernetTransport>(*netif, remoteEp, persistency, 2_s);
+ }
+
+ /**
+ * \brief Create a MulticastEthernetTransport.
+ */
+ void
+ initializeMulticast(shared_ptr<ndn::net::NetworkInterface> netif = nullptr,
+ ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_MULTI_ACCESS,
+ ethernet::Address mcastGroup = {0x01, 0x00, 0x5e, 0x90, 0x10, 0x5e})
+ {
+ if (!netif) {
+ netif = defaultNetif;
+ }
+
+ localEp = netif->getName();
+ remoteEp = mcastGroup;
+ transport = make_unique<face::MulticastEthernetTransport>(*netif, remoteEp, linkType);
+ }
+
+protected:
+ LimitedIo limitedIo;
+ shared_ptr<ndn::net::NetworkInterface> defaultNetif;
+ unique_ptr<face::EthernetTransport> transport;
+ std::string localEp;
+ ethernet::Address remoteEp;
+};
+
+} // namespace nfd::tests
+
+#define SKIP_IF_NO_RUNNING_ETHERNET_NETIF() \
+ do { \
+ if (!this->getRunningNetif()) { \
+ BOOST_WARN_MESSAGE(false, "skipping assertions that require a running " \
+ "EthernetTransport-capable network interface"); \
+ return; \
+ } \
+ } while (false)
+
+#endif // NFD_TESTS_DAEMON_FACE_ETHERNET_TRANSPORT_FIXTURE_HPP
diff --git a/tests/daemon/face/multicast-ethernet-transport.t.cpp b/tests/daemon/face/multicast-ethernet-transport.t.cpp
index 2791ca7..2694e00 100644
--- a/tests/daemon/face/multicast-ethernet-transport.t.cpp
+++ b/tests/daemon/face/multicast-ethernet-transport.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -23,7 +23,7 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ethernet-fixture.hpp"
+#include "ethernet-transport-fixture.hpp"
#include "common/global.hpp"
@@ -34,7 +34,7 @@
using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
-BOOST_FIXTURE_TEST_SUITE(TestMulticastEthernetTransport, EthernetFixture)
+BOOST_FIXTURE_TEST_SUITE(TestMulticastEthernetTransport, EthernetTransportFixture)
BOOST_AUTO_TEST_CASE(StaticProperties)
{
diff --git a/tests/daemon/face/transport-test-common.hpp b/tests/daemon/face/transport-test-common.hpp
index c257a04..4a90c77 100644
--- a/tests/daemon/face/transport-test-common.hpp
+++ b/tests/daemon/face/transport-test-common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -32,25 +32,27 @@
namespace nfd::tests {
-/** \brief Check that a transport has all its static properties set after initialization
+/**
+ * \brief Check that a transport has all its static properties set after initialization.
*
- * This check shall be inserted to the StaticProperties test case for each transport,
- * in addition to checking the values of properties.
- * When a new static property is defined, this test case shall be updated.
- * Thus, if a transport forgets to set a static property, this check would fail.
+ * This check shall be inserted to the StaticProperties test case for each transport,
+ * in addition to checking the values of properties.
+ * When a new static property is defined, this test case shall be updated.
+ * Thus, if a transport forgets to set a static property, this check would fail.
*/
inline void
checkStaticPropertiesInitialized(const face::Transport& transport)
{
- BOOST_CHECK(!transport.getLocalUri().getScheme().empty());
- BOOST_CHECK(!transport.getRemoteUri().getScheme().empty());
- BOOST_CHECK_NE(transport.getScope(), ndn::nfd::FACE_SCOPE_NONE);
- BOOST_CHECK_NE(transport.getPersistency(), ndn::nfd::FACE_PERSISTENCY_NONE);
- BOOST_CHECK_NE(transport.getLinkType(), ndn::nfd::LINK_TYPE_NONE);
- BOOST_CHECK_NE(transport.getMtu(), face::MTU_INVALID);
+ BOOST_TEST(transport.getLocalUri().getScheme().empty() == false);
+ BOOST_TEST(transport.getRemoteUri().getScheme().empty() == false);
+ BOOST_TEST(transport.getScope() != ndn::nfd::FACE_SCOPE_NONE);
+ BOOST_TEST(transport.getPersistency() != ndn::nfd::FACE_PERSISTENCY_NONE);
+ BOOST_TEST(transport.getLinkType() != ndn::nfd::LINK_TYPE_NONE);
+ BOOST_TEST(transport.getMtu() != face::MTU_INVALID);
}
-/** \brief Generic wrapper for transport fixtures that require an IP address
+/**
+ * \brief Generic wrapper for transport fixtures that require an IP address.
*/
template<typename TransportFixtureBase,
AddressFamily AF = AddressFamily::Any,
diff --git a/tests/daemon/face/transport.t.cpp b/tests/daemon/face/transport.t.cpp
index e3e427c..d405e68 100644
--- a/tests/daemon/face/transport.t.cpp
+++ b/tests/daemon/face/transport.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -145,7 +145,7 @@
auto from = static_cast<TransportState>(T::first::value);
auto to = static_cast<TransportState>(T::second::value);
- BOOST_TEST_MESSAGE("SetState " << from << " -> " << to);
+ BOOST_TEST_INFO_SCOPE(from << " -> " << to);
// enter from state
using Steps = typename mpl::at<StateEntering, mpl::int_<T::first::value>>::type;
@@ -155,12 +155,11 @@
BOOST_REQUIRE_EQUAL(transport->getState(), from);
bool hasSignal = false;
- transport->afterStateChange.connect(
- [from, to, &hasSignal] (TransportState oldState, TransportState newState) {
- hasSignal = true;
- BOOST_CHECK_EQUAL(oldState, from);
- BOOST_CHECK_EQUAL(newState, to);
- });
+ transport->afterStateChange.connect([&] (TransportState oldState, TransportState newState) {
+ hasSignal = true;
+ BOOST_CHECK_EQUAL(oldState, from);
+ BOOST_CHECK_EQUAL(newState, to);
+ });
// do transition
bool isValid = from == to ||
diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp
index 106ba0b..fd83656 100644
--- a/tests/daemon/face/udp-factory.t.cpp
+++ b/tests/daemon/face/udp-factory.t.cpp
@@ -69,7 +69,7 @@
}
}
}
- this->copyRealNetifsToNetmon();
+ copyRealNetifsToNetmon();
}
shared_ptr<Face>
@@ -106,16 +106,17 @@
std::vector<const Face*>
listUdp4McastFaces(ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_MULTI_ACCESS) const
{
- return this->listFacesByScheme("udp4", linkType);
+ return listFacesByScheme("udp4", linkType);
}
std::vector<const Face*>
listUdp6McastFaces(ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_MULTI_ACCESS) const
{
- return this->listFacesByScheme("udp6", linkType);
+ return listFacesByScheme("udp6", linkType);
}
- /** \brief Determine whether \p netif has at least one IP address of the given family.
+ /**
+ * \brief Determine whether \p netif has at least one IP address of the given family.
*/
static bool
hasAddressFamily(const NetworkInterface& netif, ndn::net::AddressFamily af)
@@ -124,7 +125,8 @@
[af] (const auto& a) { return a.getFamily() == af; });
}
- /** \brief Determine whether a UDP multicast face is created on \p netif.
+ /**
+ * \brief Determine whether a UDP multicast face is created on \p netif.
*/
static bool
isFaceOnNetif(const Face& face, const NetworkInterface& netif)
diff --git a/tests/daemon/face/unicast-ethernet-transport.t.cpp b/tests/daemon/face/unicast-ethernet-transport.t.cpp
index 373bcc3..83e4b54 100644
--- a/tests/daemon/face/unicast-ethernet-transport.t.cpp
+++ b/tests/daemon/face/unicast-ethernet-transport.t.cpp
@@ -23,7 +23,7 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ethernet-fixture.hpp"
+#include "ethernet-transport-fixture.hpp"
#include "common/global.hpp"
@@ -34,7 +34,7 @@
using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
-BOOST_FIXTURE_TEST_SUITE(TestUnicastEthernetTransport, EthernetFixture)
+BOOST_FIXTURE_TEST_SUITE(TestUnicastEthernetTransport, EthernetTransportFixture)
BOOST_AUTO_TEST_CASE(StaticProperties)
{
diff --git a/tests/daemon/fw/asf-strategy.t.cpp b/tests/daemon/fw/asf-strategy.t.cpp
index a853c79..ff8ed50 100644
--- a/tests/daemon/fw/asf-strategy.t.cpp
+++ b/tests/daemon/fw/asf-strategy.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -541,17 +541,16 @@
FaceTable faceTable;
Forwarder forwarder{faceTable};
- auto checkValidity = [&] (const std::string& parameters, bool isCorrect) {
- Name strategyName(Name(AsfStrategy::getStrategyName()).append(parameters));
+ auto checkValidity = [&] (std::string_view parameters, bool isCorrect) {
+ BOOST_TEST_INFO_SCOPE(parameters);
+ Name strategyName(Name(AsfStrategy::getStrategyName()).append(Name(parameters)));
std::unique_ptr<AsfStrategy> strategy;
- BOOST_TEST_CONTEXT(parameters) {
- if (isCorrect) {
- strategy = make_unique<AsfStrategy>(forwarder, strategyName);
- BOOST_CHECK(strategy->m_retxSuppression != nullptr);
- }
- else {
- BOOST_CHECK_THROW(make_unique<AsfStrategy>(forwarder, strategyName), std::invalid_argument);
- }
+ if (isCorrect) {
+ strategy = make_unique<AsfStrategy>(forwarder, strategyName);
+ BOOST_CHECK(strategy->m_retxSuppression != nullptr);
+ }
+ else {
+ BOOST_CHECK_THROW(make_unique<AsfStrategy>(forwarder, strategyName), std::invalid_argument);
}
return strategy;
};
diff --git a/tests/daemon/fw/strategy-instantiation.t.cpp b/tests/daemon/fw/strategy-instantiation.t.cpp
index 12c13a1..0ac730c 100644
--- a/tests/daemon/fw/strategy-instantiation.t.cpp
+++ b/tests/daemon/fw/strategy-instantiation.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -125,18 +125,17 @@
{
public:
std::unique_ptr<S>
- checkValidity(const std::string& parameters, bool isCorrect)
+ checkValidity(std::string_view parameters, bool isCorrect)
{
- Name strategyName(Name(S::getStrategyName()).append(parameters));
+ BOOST_TEST_INFO_SCOPE(parameters);
+ Name strategyName(Name(S::getStrategyName()).append(Name(parameters)));
std::unique_ptr<S> strategy;
- BOOST_TEST_CONTEXT(parameters) {
- if (isCorrect) {
- strategy = make_unique<S>(m_forwarder, strategyName);
- BOOST_CHECK(strategy->m_retxSuppression != nullptr);
- }
- else {
- BOOST_CHECK_THROW(make_unique<S>(m_forwarder, strategyName), std::invalid_argument);
- }
+ if (isCorrect) {
+ strategy = make_unique<S>(m_forwarder, strategyName);
+ BOOST_CHECK(strategy->m_retxSuppression != nullptr);
+ }
+ else {
+ BOOST_CHECK_THROW(make_unique<S>(m_forwarder, strategyName), std::invalid_argument);
}
return strategy;
}
diff --git a/tests/daemon/mgmt/face-manager.t.cpp b/tests/daemon/mgmt/face-manager.t.cpp
index 140b1c6..d73dc24 100644
--- a/tests/daemon/mgmt/face-manager.t.cpp
+++ b/tests/daemon/mgmt/face-manager.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -60,8 +60,9 @@
RANDOMIZE_COUNTERS = 1 << 3,
};
- /** \brief Adds a face to the FaceTable.
- * \param options bitwise OR'ed AddFaceFlags
+ /**
+ * \brief Adds a face to the FaceTable.
+ * \param flags bitwise OR'ed AddFaceFlags
*/
shared_ptr<Face>
addFace(unsigned int flags = 0)
@@ -169,6 +170,7 @@
std::set<FaceId> faceIds;
for (size_t idx = 0; idx < nEntries; ++idx) {
ndn::nfd::FaceStatus decodedStatus(content.elements()[idx]);
+ BOOST_TEST_INFO_SCOPE(decodedStatus);
BOOST_CHECK(m_faceTable.get(decodedStatus.getFaceId()) != nullptr);
faceIds.insert(decodedStatus.getFaceId());
}
@@ -330,6 +332,7 @@
for (size_t idx = 0; idx < nEntries; ++idx) {
ndn::nfd::ChannelStatus decodedStatus(content.elements()[idx]);
+ BOOST_TEST_INFO_SCOPE(decodedStatus);
BOOST_CHECK(addedChannels.find(decodedStatus.getLocalUri()) != addedChannels.end());
}
}
diff --git a/tests/daemon/mgmt/fib-manager.t.cpp b/tests/daemon/mgmt/fib-manager.t.cpp
index 32bbec3..5da697b 100644
--- a/tests/daemon/mgmt/fib-manager.t.cpp
+++ b/tests/daemon/mgmt/fib-manager.t.cpp
@@ -421,6 +421,7 @@
std::vector<ndn::nfd::FibEntry> receivedRecords, expectedRecords;
for (size_t idx = 0; idx < nEntries; ++idx) {
ndn::nfd::FibEntry decodedEntry(content.elements()[idx]);
+ BOOST_TEST_INFO_SCOPE(decodedEntry);
receivedRecords.push_back(decodedEntry);
actualPrefixes.erase(decodedEntry.getPrefix());
diff --git a/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp b/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
index 6c82d4a..83a0af2 100644
--- a/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
+++ b/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
@@ -71,14 +71,14 @@
loadDefaultPaConfig();
}
- template<typename ...T>
+ template<typename... T>
ndn::PrefixAnnouncement
makeTrustedAnn(T&&... args)
{
return signPrefixAnn(makePrefixAnn(std::forward<T>(args)...), m_keyChain, m_trustedSigner);
}
- template<typename ...T>
+ template<typename... T>
ndn::PrefixAnnouncement
makeUntrustedAnn(T&&... args)
{
diff --git a/tests/daemon/mgmt/rib-manager.t.cpp b/tests/daemon/mgmt/rib-manager.t.cpp
index 0b407f6..417500e 100644
--- a/tests/daemon/mgmt/rib-manager.t.cpp
+++ b/tests/daemon/mgmt/rib-manager.t.cpp
@@ -486,6 +486,7 @@
std::vector<ndn::nfd::RibEntry> receivedRecords, expectedRecords;
for (size_t idx = 0; idx < nEntries; ++idx) {
ndn::nfd::RibEntry decodedEntry(content.elements()[idx]);
+ BOOST_TEST_INFO_SCOPE(decodedEntry);
receivedRecords.push_back(decodedEntry);
actualPrefixes.erase(decodedEntry.getName());
diff --git a/tests/daemon/mgmt/strategy-choice-manager.t.cpp b/tests/daemon/mgmt/strategy-choice-manager.t.cpp
index 71763bb..4a6e3df 100644
--- a/tests/daemon/mgmt/strategy-choice-manager.t.cpp
+++ b/tests/daemon/mgmt/strategy-choice-manager.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -218,14 +218,13 @@
for (auto i = dataset.elements_begin(); i != dataset.elements_end(); ++i) {
ndn::nfd::StrategyChoice record(*i);
+ BOOST_TEST_INFO_SCOPE(record);
auto found = expected.find(record.getName());
if (found == expected.end()) {
BOOST_ERROR("record has unexpected namespace " << record.getName());
}
else {
- BOOST_CHECK_MESSAGE(record.getStrategy() == found->second,
- "record for " << record.getName() << " has wrong strategy " << record.getStrategy() <<
- ", should be " << found->second);
+ BOOST_TEST(record.getStrategy() == found->second);
expected.erase(found);
}
}
diff --git a/tests/daemon/table/fib.t.cpp b/tests/daemon/table/fib.t.cpp
index 65b1280..073d88c 100644
--- a/tests/daemon/table/fib.t.cpp
+++ b/tests/daemon/table/fib.t.cpp
@@ -244,20 +244,21 @@
BOOST_CHECK_EQUAL(fib.findLongestPrefixMatch(mABCD).getPrefix(), "/A/B/C");
}
-void
+static void
validateFindExactMatch(Fib& fib, const Name& target)
{
+ BOOST_TEST_INFO_SCOPE(target);
const Entry* entry = fib.findExactMatch(target);
- BOOST_REQUIRE_MESSAGE(entry != nullptr, "No entry found for " << target);
+ BOOST_REQUIRE(entry != nullptr);
BOOST_CHECK_EQUAL(entry->getPrefix(), target);
}
-void
+static void
validateNoExactMatch(Fib& fib, const Name& target)
{
+ BOOST_TEST_INFO_SCOPE(target);
const Entry* entry = fib.findExactMatch(target);
- BOOST_CHECK_MESSAGE(entry == nullptr,
- "Found unexpected entry for " << target);
+ BOOST_CHECK(entry == nullptr);
}
BOOST_AUTO_TEST_CASE(ExactMatch)
@@ -294,13 +295,12 @@
validateNoExactMatch(fib, "/nothing/here");
}
-void
+static void
validateErase(Fib& fib, const Name& target)
{
+ BOOST_TEST_INFO_SCOPE(target);
fib.erase(target);
-
- const Entry* entry = fib.findExactMatch(target);
- BOOST_CHECK_MESSAGE(entry == nullptr, "Found \"removed\" entry for " << target);
+ BOOST_CHECK(fib.findExactMatch(target) == nullptr);
}
BOOST_AUTO_TEST_CASE(Erase)