Refactor and modernize namespace declarations
Move all unit tests to namespace nfd::tests
Delete unused header core/algorithm.hpp
Change-Id: I5591f0c5f3bb5db67f8b45fae95471f8a555ca68
diff --git a/tests/daemon/face/channel-fixture.hpp b/tests/daemon/face/channel-fixture.hpp
index c3d07c6..f612f6d 100644
--- a/tests/daemon/face/channel-fixture.hpp
+++ b/tests/daemon/face/channel-fixture.hpp
@@ -34,16 +34,12 @@
#include <type_traits>
-namespace nfd {
-namespace face {
-namespace tests {
-
-using namespace nfd::tests;
+namespace nfd::tests {
template<class ChannelT, class EndpointT>
class ChannelFixture : public GlobalIoFixture
{
- static_assert(std::is_base_of_v<Channel, ChannelT>);
+ static_assert(std::is_base_of_v<face::Channel, ChannelT>);
public:
virtual
@@ -108,8 +104,6 @@
uint16_t m_nextPort = 7050;
};
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_CHANNEL_FIXTURE_HPP
diff --git a/tests/daemon/face/datagram-transport.t.cpp b/tests/daemon/face/datagram-transport.t.cpp
index 631e394..055584c 100644
--- a/tests/daemon/face/datagram-transport.t.cpp
+++ b/tests/daemon/face/datagram-transport.t.cpp
@@ -30,9 +30,9 @@
#include <boost/mpl/vector.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_AUTO_TEST_SUITE(TestDatagramTransport)
@@ -174,6 +174,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestDatagramTransport
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/dummy-face.cpp b/tests/daemon/face/dummy-face.cpp
index b7e74ca..246f9cc 100644
--- a/tests/daemon/face/dummy-face.cpp
+++ b/tests/daemon/face/dummy-face.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,
@@ -27,9 +27,7 @@
#include "dummy-link-service.hpp"
#include "dummy-transport.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
DummyFace::DummyFace(const std::string& localUri, const std::string& remoteUri,
ndn::nfd::FaceScope scope, ndn::nfd::FacePersistency persistency,
@@ -45,7 +43,7 @@
}
void
-DummyFace::setState(FaceState state)
+DummyFace::setState(face::FaceState state)
{
static_cast<DummyTransport*>(getTransport())->setState(state);
}
@@ -74,6 +72,4 @@
return static_cast<DummyLinkService*>(getLinkService());
}
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/dummy-face.hpp b/tests/daemon/face/dummy-face.hpp
index 94b5363..8374430 100644
--- a/tests/daemon/face/dummy-face.hpp
+++ b/tests/daemon/face/dummy-face.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,9 +28,7 @@
#include "face/face.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
class DummyLinkService;
@@ -57,7 +55,7 @@
* \throw std::runtime_error state transition is invalid
*/
void
- setState(FaceState state);
+ setState(face::FaceState state);
/** \brief causes the face to receive an Interest
*/
@@ -92,13 +90,6 @@
std::vector<lp::Nack>& sentNacks;
};
-} // namespace tests
-} // namespace face
-
-namespace tests {
-using nfd::face::tests::DummyFace;
-} // namespace tests
-
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_DUMMY_FACE_HPP
diff --git a/tests/daemon/face/dummy-link-service.cpp b/tests/daemon/face/dummy-link-service.cpp
index 820d05b..5b33784 100644
--- a/tests/daemon/face/dummy-link-service.cpp
+++ b/tests/daemon/face/dummy-link-service.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, 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,
@@ -25,9 +25,7 @@
#include "dummy-link-service.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
void
DummyLinkService::doSendInterest(const Interest& interest)
@@ -63,6 +61,4 @@
receivedPackets.push_back({packet, endpoint});
}
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/dummy-link-service.hpp b/tests/daemon/face/dummy-link-service.hpp
index 3d77968..6661f0c 100644
--- a/tests/daemon/face/dummy-link-service.hpp
+++ b/tests/daemon/face/dummy-link-service.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, 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,9 +28,7 @@
#include "face/link-service.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
enum PacketLoggingFlags : unsigned {
LogNothing = 0, ///< disable packet logging
@@ -50,7 +48,7 @@
/** \brief A dummy LinkService that logs all sent and received packets.
*/
-class DummyLinkService final : public LinkService
+class DummyLinkService final : public face::LinkService
{
public:
/** \brief Emitted after a network-layer packet is sent through this link service.
@@ -94,8 +92,6 @@
PacketLoggingFlags m_loggingFlags = LogAllPackets;
};
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_DUMMY_LINK_SERVICE_HPP
diff --git a/tests/daemon/face/dummy-transport.hpp b/tests/daemon/face/dummy-transport.hpp
index 8ebb582..2eb21fe 100644
--- a/tests/daemon/face/dummy-transport.hpp
+++ b/tests/daemon/face/dummy-transport.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, 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,
@@ -30,9 +30,7 @@
#include "face/null-transport.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
/** \brief Dummy Transport type used in unit tests.
*
@@ -41,7 +39,7 @@
* All persistency changes are recorded in `persistencyHistory`.
*/
template<bool CAN_CHANGE_PERSISTENCY>
-class DummyTransportBase : public NullTransport
+class DummyTransportBase : public face::NullTransport
{
public:
explicit
@@ -50,8 +48,8 @@
ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_NON_LOCAL,
ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_POINT_TO_POINT,
- ssize_t mtu = MTU_UNLIMITED,
- ssize_t sendQueueCapacity = QUEUE_UNSUPPORTED)
+ ssize_t mtu = face::MTU_UNLIMITED,
+ ssize_t sendQueueCapacity = face::QUEUE_UNSUPPORTED)
: NullTransport(FaceUri(localUri), FaceUri(remoteUri), scope, persistency)
{
this->setLinkType(linkType);
@@ -110,8 +108,6 @@
using DummyTransport = DummyTransportBase<true>;
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_DUMMY_TRANSPORT_HPP
diff --git a/tests/daemon/face/ethernet-channel.t.cpp b/tests/daemon/face/ethernet-channel.t.cpp
index 753f36a..95bf034 100644
--- a/tests/daemon/face/ethernet-channel.t.cpp
+++ b/tests/daemon/face/ethernet-channel.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, 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,
@@ -29,9 +29,9 @@
#include "tests/test-common.hpp"
#include "ethernet-fixture.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using face::EthernetChannel;
class EthernetChannelFixture : public EthernetFixture
{
@@ -99,6 +99,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestEthernetChannel
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/ethernet-factory.t.cpp b/tests/daemon/face/ethernet-factory.t.cpp
index 269c79f..b6d2516 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-2020, 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,
@@ -31,9 +31,9 @@
#include <boost/algorithm/string/replace.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using face::EthernetFactory;
class EthernetFactoryFixture : public EthernetFixture
, public FaceSystemFactoryFixture<EthernetFactory>
@@ -548,6 +548,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestEthernetFactory
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/ethernet-fixture.hpp b/tests/daemon/face/ethernet-fixture.hpp
index 0c98c72..915b2c0 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-2020, 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,
@@ -32,13 +32,14 @@
#include "tests/daemon/limited-io.hpp"
#include "test-netif.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
-using namespace nfd::tests;
+using face::EthernetTransport;
+using face::MulticastEthernetTransport;
+using face::UnicastEthernetTransport;
-/** \brief Fixture providing a list of EthernetTransport-capable network interfaces.
+/**
+ * \brief Fixture providing a list of EthernetTransport-capable network interfaces.
*/
class EthernetFixture : public virtual GlobalIoFixture
{
@@ -48,8 +49,8 @@
for (const auto& netif : collectNetworkInterfaces()) {
if (!netif->isLoopback() && netif->isUp()) {
try {
- MulticastEthernetTransport transport(*netif, ethernet::getBroadcastAddress(),
- ndn::nfd::LINK_TYPE_MULTI_ACCESS);
+ MulticastEthernetTransport t(*netif, ethernet::getBroadcastAddress(),
+ ndn::nfd::LINK_TYPE_MULTI_ACCESS);
netifs.push_back(netif);
}
catch (const EthernetTransport::Error&) {
@@ -121,6 +122,8 @@
ethernet::Address remoteEp;
};
+} // namespace nfd::tests
+
#define SKIP_IF_ETHERNET_NETIF_COUNT_LT(n) \
do { \
if (this->netifs.size() < (n)) { \
@@ -139,8 +142,4 @@
} \
} while (false)
-} // namespace tests
-} // namespace face
-} // namespace nfd
-
#endif // NFD_TESTS_DAEMON_FACE_ETHERNET_FIXTURE_HPP
diff --git a/tests/daemon/face/face-system-fixture.hpp b/tests/daemon/face/face-system-fixture.hpp
index de3aca8..1891a97 100644
--- a/tests/daemon/face/face-system-fixture.hpp
+++ b/tests/daemon/face/face-system-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,
@@ -37,11 +37,7 @@
#include <ndn-cxx/net/network-monitor-stub.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
-
-using namespace nfd::tests;
+namespace nfd::tests {
class FaceSystemFixture : public virtual GlobalIoFixture
{
@@ -140,10 +136,11 @@
FaceTable faceTable;
shared_ptr<ndn::net::NetworkMonitorStub> netmon;
FaceSystem faceSystem;
- NetdevBound& netdevBound;
+ face::NetdevBound& netdevBound;
};
-/** \brief FaceSystemFixture with a ProtocolFactory reference
+/**
+ * \brief FaceSystemFixture with a ProtocolFactory reference
*/
template<typename FactoryType>
class FaceSystemFactoryFixture : public FaceSystemFixture
@@ -158,9 +155,10 @@
FactoryType& factory;
};
-/** \brief A dummy ProtocolFactory for testing FaceSystem configuration parsing.
+/**
+ * \brief A dummy ProtocolFactory for testing FaceSystem configuration parsing.
*/
-class DummyProtocolFactory : public ProtocolFactory
+class DummyProtocolFactory : public face::ProtocolFactory
{
public:
using ProtocolFactory::ProtocolFactory;
@@ -188,8 +186,6 @@
std::set<std::string> newProvidedSchemes;
};
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_FACE_SYSTEM_FIXTURE_HPP
diff --git a/tests/daemon/face/face-system.t.cpp b/tests/daemon/face/face-system.t.cpp
index a7be4c8..336aa11 100644
--- a/tests/daemon/face/face-system.t.cpp
+++ b/tests/daemon/face/face-system.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, 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,9 +28,9 @@
#include "tests/test-common.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestFaceSystem, FaceSystemFixture)
@@ -164,6 +164,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestFaceSystem
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/face.t.cpp b/tests/daemon/face/face.t.cpp
index bcaa90a..34a19a7 100644
--- a/tests/daemon/face/face.t.cpp
+++ b/tests/daemon/face/face.t.cpp
@@ -31,11 +31,9 @@
#include "dummy-face.hpp"
#include "dummy-transport.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
-using namespace nfd::tests;
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestFace, GlobalIoFixture)
@@ -149,6 +147,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestFace
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/factory-test-common.hpp b/tests/daemon/face/factory-test-common.hpp
index 4e65d34..1c7252e 100644
--- a/tests/daemon/face/factory-test-common.hpp
+++ b/tests/daemon/face/factory-test-common.hpp
@@ -30,9 +30,7 @@
#include "tests/test-common.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
struct CreateFaceExpectedResult
{
@@ -42,46 +40,44 @@
};
inline void
-createFace(ProtocolFactory& factory,
+createFace(face::ProtocolFactory& factory,
const FaceUri& remoteUri,
const std::optional<FaceUri>& localUri,
- const FaceParams& params,
+ const face::FaceParams& params,
const CreateFaceExpectedResult& expected,
const std::function<void(const Face&)>& extraChecks = nullptr)
{
factory.createFace({remoteUri, localUri, params},
- [expected, extraChecks] (const shared_ptr<Face>& face) {
- BOOST_CHECK_EQUAL(CreateFaceExpectedResult::SUCCESS, expected.result);
+ [result = expected.result, extraChecks] (const auto& face) {
+ BOOST_CHECK_EQUAL(CreateFaceExpectedResult::SUCCESS, result);
if (extraChecks) {
extraChecks(*face);
}
},
- [expected] (uint32_t actualStatus, const std::string& actualReason) {
+ [expected] (uint32_t actualStatus, const auto& actualReason) {
BOOST_CHECK_EQUAL(CreateFaceExpectedResult::FAILURE, expected.result);
BOOST_CHECK_EQUAL(actualStatus, expected.status);
BOOST_CHECK_EQUAL(actualReason, expected.reason);
});
}
-/** \brief check that channels in a factory equal given channel URIs
+/**
+ * \brief Check that channels in a factory equal given channel URIs
*/
inline void
-checkChannelListEqual(const ProtocolFactory& factory, const std::set<std::string>& channelUris)
+checkChannelListEqual(const face::ProtocolFactory& factory, std::set<std::string> expectedUris)
{
- std::set<std::string> expected(channelUris); // make a copy so we can erase as we go
for (const auto& channel : factory.getChannels()) {
- std::string uri = channel->getUri().toString();
- if (expected.erase(uri) == 0) {
+ auto uri = channel->getUri().toString();
+ if (expectedUris.erase(uri) == 0) {
BOOST_ERROR("Unexpected channel " << uri);
}
}
- for (const auto& uri : expected) {
+ for (const auto& uri : expectedUris) {
BOOST_ERROR("Missing channel " << uri);
}
}
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_FACTORY_TEST_COMMON_HPP
diff --git a/tests/daemon/face/generic-link-service.t.cpp b/tests/daemon/face/generic-link-service.t.cpp
index e4f0425..06d9417 100644
--- a/tests/daemon/face/generic-link-service.t.cpp
+++ b/tests/daemon/face/generic-link-service.t.cpp
@@ -35,11 +35,9 @@
#include <ndn-cxx/lp/prefix-announcement-header.hpp>
#include <ndn-cxx/lp/tags.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
-using namespace nfd::tests;
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
@@ -1470,6 +1468,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestGenericLinkService
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/internal-face.t.cpp b/tests/daemon/face/internal-face.t.cpp
index 1f2b82a..5c57341 100644
--- a/tests/daemon/face/internal-face.t.cpp
+++ b/tests/daemon/face/internal-face.t.cpp
@@ -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,
@@ -29,11 +29,9 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/daemon/global-io-fixture.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
-using namespace nfd::tests;
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
@@ -218,6 +216,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestInternalFace
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/lp-fragmenter.t.cpp b/tests/daemon/face/lp-fragmenter.t.cpp
index 8bd48c2..065fc6d 100644
--- a/tests/daemon/face/lp-fragmenter.t.cpp
+++ b/tests/daemon/face/lp-fragmenter.t.cpp
@@ -27,11 +27,9 @@
#include "tests/test-common.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
-using namespace nfd::tests;
+using namespace nfd::face;
class LpFragmenterFixture
{
@@ -174,6 +172,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestLpFragmentation
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/lp-reassembler.t.cpp b/tests/daemon/face/lp-reassembler.t.cpp
index 8e8bbce..16a3592 100644
--- a/tests/daemon/face/lp-reassembler.t.cpp
+++ b/tests/daemon/face/lp-reassembler.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,11 +28,9 @@
#include "tests/test-common.hpp"
#include "tests/daemon/global-io-fixture.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
-using namespace nfd::tests;
+using namespace nfd::face;
class LpReassemblerFixture : public GlobalIoTimeFixture
{
@@ -41,7 +39,7 @@
{
reassembler.beforeTimeout.connect(
[this] (EndpointId remoteEp, size_t nDroppedFragments) {
- timeoutHistory.push_back({remoteEp, nDroppedFragments});
+ timeoutHistory.emplace_back(remoteEp, nDroppedFragments);
});
}
@@ -49,12 +47,10 @@
LpReassembler reassembler{{}};
std::vector<std::pair<EndpointId, size_t>> timeoutHistory;
- static const uint8_t data[10];
-};
-
-const uint8_t LpReassemblerFixture::data[10] = {
- 0x06, 0x08, // Data
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ static constexpr uint8_t data[] = {
+ 0x06, 0x08, // Data
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ };
};
BOOST_AUTO_TEST_SUITE(Face)
@@ -517,6 +513,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestLpReassembler
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/lp-reliability.t.cpp b/tests/daemon/face/lp-reliability.t.cpp
index 0d891e0..81c28e0 100644
--- a/tests/daemon/face/lp-reliability.t.cpp
+++ b/tests/daemon/face/lp-reliability.t.cpp
@@ -35,11 +35,9 @@
#include <cstring>
#include <unordered_set>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
-using namespace nfd::tests;
+using namespace nfd::face;
class DummyLpReliabilityLinkService : public GenericLinkService
{
@@ -1043,6 +1041,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestLpReliability
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/multicast-ethernet-transport.t.cpp b/tests/daemon/face/multicast-ethernet-transport.t.cpp
index 84dead4..bff61c7 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-2020, 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,
@@ -29,9 +29,9 @@
#include "common/global.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestMulticastEthernetTransport, EthernetFixture)
@@ -140,6 +140,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestMulticastEthernetTransport
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/multicast-udp-transport-fixture.hpp b/tests/daemon/face/multicast-udp-transport-fixture.hpp
index 99d039c..959ca9c 100644
--- a/tests/daemon/face/multicast-udp-transport-fixture.hpp
+++ b/tests/daemon/face/multicast-udp-transport-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,
@@ -33,26 +33,15 @@
#include "tests/daemon/limited-io.hpp"
#include "tests/daemon/face/dummy-link-service.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
-using namespace nfd::tests;
namespace ip = boost::asio::ip;
using ip::udp;
+using face::MulticastUdpTransport;
class MulticastUdpTransportFixture : public GlobalIoFixture
{
protected:
- MulticastUdpTransportFixture()
- : transport(nullptr)
- , txPort(7001)
- , receivedPackets(nullptr)
- , remoteSockRx(g_io)
- , remoteSockTx(g_io)
- {
- }
-
void
initialize(ip::address address)
{
@@ -84,7 +73,7 @@
transport = static_cast<MulticastUdpTransport*>(face->getTransport());
receivedPackets = &static_cast<DummyLinkService*>(face->getLinkService())->receivedPackets;
- BOOST_REQUIRE_EQUAL(transport->getState(), TransportState::UP);
+ BOOST_REQUIRE_EQUAL(transport->getState(), face::TransportState::UP);
}
void
@@ -120,20 +109,18 @@
protected:
LimitedIo limitedIo;
- MulticastUdpTransport* transport;
+ MulticastUdpTransport* transport = nullptr;
udp::endpoint mcastEp;
- uint16_t txPort;
- std::vector<RxPacket>* receivedPackets;
+ uint16_t txPort = 7001;
+ std::vector<RxPacket>* receivedPackets = nullptr;
private:
unique_ptr<Face> face;
udp::endpoint remoteMcastEp;
- udp::socket remoteSockRx;
- udp::socket remoteSockTx;
+ udp::socket remoteSockRx{g_io};
+ udp::socket remoteSockTx{g_io};
};
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_MULTICAST_UDP_TRANSPORT_FIXTURE_HPP
diff --git a/tests/daemon/face/multicast-udp-transport.t.cpp b/tests/daemon/face/multicast-udp-transport.t.cpp
index 636bdc5..f32d30f 100644
--- a/tests/daemon/face/multicast-udp-transport.t.cpp
+++ b/tests/daemon/face/multicast-udp-transport.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,
@@ -29,9 +29,9 @@
#include <boost/mpl/vector.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
@@ -114,6 +114,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestMulticastUdpTransport
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/netdev-bound.t.cpp b/tests/daemon/face/netdev-bound.t.cpp
index 9f71fc1..ede55c3 100644
--- a/tests/daemon/face/netdev-bound.t.cpp
+++ b/tests/daemon/face/netdev-bound.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, 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,9 +28,9 @@
#include "tests/test-common.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestNetdevBound, FaceSystemFixture)
@@ -111,6 +111,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNetdevBound
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/network-predicate.t.cpp b/tests/daemon/face/network-predicate.t.cpp
index 73e29c6..05094fc 100644
--- a/tests/daemon/face/network-predicate.t.cpp
+++ b/tests/daemon/face/network-predicate.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,
@@ -34,9 +34,7 @@
#include <boost/property_tree/info_parser.hpp>
#include <sstream>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
BOOST_AUTO_TEST_SUITE(Face)
BOOST_AUTO_TEST_SUITE(TestNetworkPredicate)
@@ -66,7 +64,7 @@
T predicate;
};
-class NetworkInterfacePredicateFixture : public NetworkPredicateBaseFixture<NetworkInterfacePredicate>
+class NetworkInterfacePredicateFixture : public NetworkPredicateBaseFixture<face::NetworkInterfacePredicate>
{
protected:
NetworkInterfacePredicateFixture()
@@ -377,7 +375,7 @@
BOOST_AUTO_TEST_SUITE_END() // NetworkInterface
-class IpAddressPredicateFixture : public NetworkPredicateBaseFixture<IpAddressPredicate>
+class IpAddressPredicateFixture : public NetworkPredicateBaseFixture<face::IpAddressPredicate>
{
protected:
IpAddressPredicateFixture()
@@ -512,6 +510,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNetworkPredicate
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/null-face.t.cpp b/tests/daemon/face/null-face.t.cpp
index 4a5f539..ad5e4cf 100644
--- a/tests/daemon/face/null-face.t.cpp
+++ b/tests/daemon/face/null-face.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, 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,
@@ -29,11 +29,9 @@
#include "tests/daemon/global-io-fixture.hpp"
#include "transport-test-common.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
-using namespace nfd::tests;
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestNullFace, GlobalIoFixture)
@@ -102,6 +100,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNullFace
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/stream-transport.t.cpp b/tests/daemon/face/stream-transport.t.cpp
index c8fa82b..80524b5 100644
--- a/tests/daemon/face/stream-transport.t.cpp
+++ b/tests/daemon/face/stream-transport.t.cpp
@@ -30,9 +30,9 @@
#include <boost/mpl/vector.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_AUTO_TEST_SUITE(TestStreamTransport)
@@ -236,6 +236,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestStreamTransport
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/tcp-channel-fixture.hpp b/tests/daemon/face/tcp-channel-fixture.hpp
index ab8d431..b6eb99c 100644
--- a/tests/daemon/face/tcp-channel-fixture.hpp
+++ b/tests/daemon/face/tcp-channel-fixture.hpp
@@ -31,9 +31,9 @@
#include "channel-fixture.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using face::TcpChannel;
class TcpChannelFixture : public ChannelFixture<TcpChannel, tcp::Endpoint>
{
@@ -83,11 +83,9 @@
protected:
std::vector<shared_ptr<Face>> clientFaces;
- IpAddressPredicate local;
+ face::IpAddressPredicate local;
};
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_TCP_CHANNEL_FIXTURE_HPP
diff --git a/tests/daemon/face/tcp-channel.t.cpp b/tests/daemon/face/tcp-channel.t.cpp
index 6789966..9f838c4 100644
--- a/tests/daemon/face/tcp-channel.t.cpp
+++ b/tests/daemon/face/tcp-channel.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,
@@ -26,11 +26,10 @@
#include "tcp-channel-fixture.hpp"
#include "test-ip.hpp"
+
#include <boost/mpl/vector.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestTcpChannel, TcpChannelFixture)
@@ -64,6 +63,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTcpChannel
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/tcp-factory.t.cpp b/tests/daemon/face/tcp-factory.t.cpp
index a6335f9..2547e30 100644
--- a/tests/daemon/face/tcp-factory.t.cpp
+++ b/tests/daemon/face/tcp-factory.t.cpp
@@ -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,
@@ -29,9 +29,10 @@
#include "factory-test-common.hpp"
#include "tests/daemon/limited-io.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using face::TcpChannel;
+using face::TcpFactory;
class TcpFactoryFixture : public FaceSystemFactoryFixture<TcpFactory>
{
@@ -175,7 +176,7 @@
BOOST_CHECK_EQUAL(face.getScope(), ndn::nfd::FACE_SCOPE_LOCAL);
});
- limitedIo.run(1, 100_ms);
+ limitedIo.defer(100_ms);
}
BOOST_AUTO_TEST_CASE(ConfigureNonLocal)
@@ -217,7 +218,7 @@
BOOST_CHECK_EQUAL(face.getScope(), ndn::nfd::FACE_SCOPE_NON_LOCAL);
});
- limitedIo.run(1, 100_ms);
+ limitedIo.defer(100_ms);
}
BOOST_AUTO_TEST_CASE(Omitted)
@@ -468,6 +469,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTcpFactory
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/tcp-transport-fixture.hpp b/tests/daemon/face/tcp-transport-fixture.hpp
index 4b382a8..2ea4a2b 100644
--- a/tests/daemon/face/tcp-transport-fixture.hpp
+++ b/tests/daemon/face/tcp-transport-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,
@@ -33,25 +33,15 @@
#include "tests/daemon/limited-io.hpp"
#include "tests/daemon/face/dummy-link-service.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
-using namespace nfd::tests;
namespace ip = boost::asio::ip;
using ip::tcp;
+using face::TcpTransport;
class TcpTransportFixture : public GlobalIoFixture
{
protected:
- TcpTransportFixture()
- : transport(nullptr)
- , remoteSocket(g_io)
- , receivedPackets(nullptr)
- , acceptor(g_io)
- {
- }
-
void
startAccept(const tcp::endpoint& remoteEp)
{
@@ -103,7 +93,7 @@
transport = static_cast<TcpTransport*>(face->getTransport());
receivedPackets = &static_cast<DummyLinkService*>(face->getLinkService())->receivedPackets;
- BOOST_REQUIRE_EQUAL(transport->getState(), TransportState::UP);
+ BOOST_REQUIRE_EQUAL(transport->getState(), face::TransportState::UP);
}
void
@@ -120,18 +110,16 @@
protected:
LimitedIo limitedIo;
- TcpTransport* transport;
+ TcpTransport* transport = nullptr;
tcp::endpoint localEp;
- tcp::socket remoteSocket;
- std::vector<RxPacket>* receivedPackets;
+ tcp::socket remoteSocket{g_io};
+ std::vector<RxPacket>* receivedPackets = nullptr;
private:
- tcp::acceptor acceptor;
+ tcp::acceptor acceptor{g_io};
unique_ptr<Face> face;
};
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_TCP_TRANSPORT_FIXTURE_HPP
diff --git a/tests/daemon/face/tcp-transport.t.cpp b/tests/daemon/face/tcp-transport.t.cpp
index c01aaef..3d86064 100644
--- a/tests/daemon/face/tcp-transport.t.cpp
+++ b/tests/daemon/face/tcp-transport.t.cpp
@@ -29,9 +29,9 @@
#include <boost/mpl/vector.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestTcpTransport, IpTransportFixture<TcpTransportFixture>)
@@ -234,6 +234,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTcpTransport
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/tcp-udp-channel.t.cpp b/tests/daemon/face/tcp-udp-channel.t.cpp
index 020c954..6a29660 100644
--- a/tests/daemon/face/tcp-udp-channel.t.cpp
+++ b/tests/daemon/face/tcp-udp-channel.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, 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,
@@ -27,11 +27,10 @@
#include "udp-channel-fixture.hpp"
#include "test-ip.hpp"
+
#include <boost/mpl/vector.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
BOOST_AUTO_TEST_SUITE(Face)
BOOST_AUTO_TEST_SUITE(TestTcpUdpChannel)
@@ -150,6 +149,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTcpUdpChannel
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/test-ip.cpp b/tests/daemon/face/test-ip.cpp
index 3e75d8c..593797e 100644
--- a/tests/daemon/face/test-ip.cpp
+++ b/tests/daemon/face/test-ip.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, 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,
@@ -26,9 +26,7 @@
#include "test-ip.hpp"
#include "test-netif.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
std::ostream&
operator<<(std::ostream& os, AddressFamily family)
@@ -106,6 +104,4 @@
return {};
}
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/test-ip.hpp b/tests/daemon/face/test-ip.hpp
index 1b8604e..c2bb8ca 100644
--- a/tests/daemon/face/test-ip.hpp
+++ b/tests/daemon/face/test-ip.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, 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,
@@ -31,9 +31,7 @@
#include <boost/asio/ip/address.hpp>
#include <ndn-cxx/net/network-address.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
enum class AddressFamily {
V4 = static_cast<int>(ndn::net::AddressFamily::V4),
@@ -92,9 +90,11 @@
AddressScope scope = AddressScope::Any,
MulticastInterface mcast = MulticastInterface::Any);
+} // namespace nfd::tests
+
/** \brief Skip the rest of the test case if \p address is unavailable
*
- * This macro can be used in conjunction with nfd::tests::getTestIp in a test case. Example:
+ * This macro can be used in conjunction with nfd::tests::getTestIp() in a test case. Example:
* \code
* BOOST_AUTO_TEST_CASE(TestCase)
* {
@@ -112,8 +112,4 @@
} \
} while (false)
-} // namespace tests
-} // namespace face
-} // namespace nfd
-
#endif // NFD_TESTS_DAEMON_FACE_TEST_IP_HPP
diff --git a/tests/daemon/face/test-netif.cpp b/tests/daemon/face/test-netif.cpp
index 36719ad..1a2752b 100644
--- a/tests/daemon/face/test-netif.cpp
+++ b/tests/daemon/face/test-netif.cpp
@@ -26,9 +26,7 @@
#include "test-netif.hpp"
#include "common/global.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
std::vector<shared_ptr<const NetworkInterface>>
enumerateNetworkInterfaces(NetworkMonitor& netmon)
@@ -52,6 +50,4 @@
return *cached;
}
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/test-netif.hpp b/tests/daemon/face/test-netif.hpp
index 42820dd..a1e354e 100644
--- a/tests/daemon/face/test-netif.hpp
+++ b/tests/daemon/face/test-netif.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,
@@ -32,9 +32,7 @@
#include <ndn-cxx/net/network-interface.hpp>
#include <ndn-cxx/net/network-monitor.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
using ndn::net::NetworkAddress;
using ndn::net::NetworkInterface;
@@ -56,8 +54,6 @@
std::vector<shared_ptr<const NetworkInterface>>
collectNetworkInterfaces(bool allowCached = true);
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_TEST_NETIF_HPP
diff --git a/tests/daemon/face/transport-test-common.hpp b/tests/daemon/face/transport-test-common.hpp
index fa3e4bd..34133a1 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-2017, 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,
@@ -30,9 +30,7 @@
#include "tests/test-common.hpp"
#include "test-ip.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
/** \brief Check that a transport has all its static properties set after initialization
*
@@ -42,14 +40,14 @@
* Thus, if a transport forgets to set a static property, this check would fail.
*/
inline void
-checkStaticPropertiesInitialized(const Transport& transport)
+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(), MTU_INVALID);
+ BOOST_CHECK_NE(transport.getMtu(), face::MTU_INVALID);
}
/** \brief Generic wrapper for transport fixtures that require an IP address
@@ -69,7 +67,7 @@
" TestIp=" << address);
}
- std::pair<bool, std::string>
+ [[nodiscard]] std::pair<bool, std::string>
checkPreconditions() const
{
return {!address.is_unspecified(), "no appropriate IP address available"};
@@ -88,9 +86,7 @@
const boost::asio::ip::address address = getTestIp(AF, AS, MC);
};
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#define GENERATE_IP_TRANSPORT_FIXTURE_INSTANTIATIONS(F) \
IpTransportFixture<F, AddressFamily::V4, AddressScope::Loopback>, \
@@ -101,9 +97,9 @@
#define TRANSPORT_TEST_CHECK_PRECONDITIONS() \
do { \
- auto result = this->checkPreconditions(); \
- if (!result.first) { \
- BOOST_WARN_MESSAGE(false, "skipping test case: " << result.second); \
+ auto [ok, reason] = this->checkPreconditions(); \
+ if (!ok) { \
+ BOOST_WARN_MESSAGE(false, "skipping test case: " << reason); \
return; \
} \
} while (false)
diff --git a/tests/daemon/face/transport.t.cpp b/tests/daemon/face/transport.t.cpp
index 7e650dd..9545b83 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-2020, 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,
@@ -40,12 +40,10 @@
#include <boost/mpl/set.hpp>
#include <boost/mpl/vector.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
namespace mpl = boost::mpl;
-using namespace nfd::tests;
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_AUTO_TEST_SUITE(TestTransport)
@@ -145,8 +143,8 @@
{
auto transport = make_unique<DummyTransport>();
- TransportState from = static_cast<TransportState>(T::first::value);
- TransportState to = static_cast<TransportState>(T::second::value);
+ auto from = static_cast<TransportState>(T::first::value);
+ auto to = static_cast<TransportState>(T::second::value);
BOOST_TEST_MESSAGE("SetState " << from << " -> " << to);
// enter from state
@@ -248,6 +246,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTransport
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/udp-channel-fixture.hpp b/tests/daemon/face/udp-channel-fixture.hpp
index ac30738..a314a8c 100644
--- a/tests/daemon/face/udp-channel-fixture.hpp
+++ b/tests/daemon/face/udp-channel-fixture.hpp
@@ -31,9 +31,9 @@
#include "channel-fixture.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using face::UdpChannel;
class UdpChannelFixture : public ChannelFixture<UdpChannel, udp::Endpoint>
{
@@ -69,8 +69,6 @@
std::vector<shared_ptr<Face>> clientFaces;
};
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_UDP_CHANNEL_FIXTURE_HPP
diff --git a/tests/daemon/face/udp-channel.t.cpp b/tests/daemon/face/udp-channel.t.cpp
index b61e5af..d36e2f5 100644
--- a/tests/daemon/face/udp-channel.t.cpp
+++ b/tests/daemon/face/udp-channel.t.cpp
@@ -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,
@@ -26,11 +26,10 @@
#include "udp-channel-fixture.hpp"
#include "test-ip.hpp"
+
#include <boost/mpl/vector.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestUdpChannel, UdpChannelFixture)
@@ -64,6 +63,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestUdpChannel
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp
index e2788f5..c243ddc 100644
--- a/tests/daemon/face/udp-factory.t.cpp
+++ b/tests/daemon/face/udp-factory.t.cpp
@@ -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,
@@ -30,9 +30,10 @@
#include <boost/algorithm/string/replace.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using face::UdpChannel;
+using face::UdpFactory;
class UdpFactoryFixture : public FaceSystemFactoryFixture<UdpFactory>
{
@@ -1114,6 +1115,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestUdpFactory
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/unicast-ethernet-transport.t.cpp b/tests/daemon/face/unicast-ethernet-transport.t.cpp
index 79a0f38..54c262d 100644
--- a/tests/daemon/face/unicast-ethernet-transport.t.cpp
+++ b/tests/daemon/face/unicast-ethernet-transport.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, 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,
@@ -29,9 +29,9 @@
#include "common/global.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestUnicastEthernetTransport, EthernetFixture)
@@ -180,6 +180,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestUnicastEthernetTransport
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/unicast-udp-transport-fixture.hpp b/tests/daemon/face/unicast-udp-transport-fixture.hpp
index ce9006d..e7fb76d 100644
--- a/tests/daemon/face/unicast-udp-transport-fixture.hpp
+++ b/tests/daemon/face/unicast-udp-transport-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,
@@ -33,24 +33,15 @@
#include "tests/daemon/limited-io.hpp"
#include "tests/daemon/face/dummy-link-service.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
-using namespace nfd::tests;
namespace ip = boost::asio::ip;
using ip::udp;
+using face::UnicastUdpTransport;
class UnicastUdpTransportFixture : public GlobalIoFixture
{
protected:
- UnicastUdpTransportFixture()
- : transport(nullptr)
- , remoteSocket(g_io)
- , receivedPackets(nullptr)
- {
- }
-
void
initialize(ip::address address,
ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
@@ -66,7 +57,7 @@
transport = static_cast<UnicastUdpTransport*>(face->getTransport());
receivedPackets = &static_cast<DummyLinkService*>(face->getLinkService())->receivedPackets;
- BOOST_REQUIRE_EQUAL(transport->getState(), TransportState::UP);
+ BOOST_REQUIRE_EQUAL(transport->getState(), face::TransportState::UP);
}
void
@@ -106,17 +97,15 @@
protected:
LimitedIo limitedIo;
- UnicastUdpTransport* transport;
+ UnicastUdpTransport* transport = nullptr;
udp::endpoint localEp;
- udp::socket remoteSocket;
- std::vector<RxPacket>* receivedPackets;
+ udp::socket remoteSocket{g_io};
+ std::vector<RxPacket>* receivedPackets = nullptr;
private:
unique_ptr<Face> face;
};
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_UNICAST_UDP_TRANSPORT_FIXTURE_HPP
diff --git a/tests/daemon/face/unicast-udp-transport.t.cpp b/tests/daemon/face/unicast-udp-transport.t.cpp
index 24d47fd..bb5605e 100644
--- a/tests/daemon/face/unicast-udp-transport.t.cpp
+++ b/tests/daemon/face/unicast-udp-transport.t.cpp
@@ -30,9 +30,9 @@
#include <boost/mpl/vector.hpp>
#include <boost/mpl/vector_c.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestUnicastUdpTransport, IpTransportFixture<UnicastUdpTransportFixture>)
@@ -177,6 +177,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestUnicastUdpTransport
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/unix-stream-channel.t.cpp b/tests/daemon/face/unix-stream-channel.t.cpp
index fa9e480..e4ce0cf 100644
--- a/tests/daemon/face/unix-stream-channel.t.cpp
+++ b/tests/daemon/face/unix-stream-channel.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, 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,
@@ -30,12 +30,11 @@
#include <boost/filesystem.hpp>
#include <fstream>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
namespace fs = boost::filesystem;
namespace local = boost::asio::local;
+using face::UnixStreamChannel;
class UnixStreamChannelFixture : public ChannelFixture<UnixStreamChannel, unix_stream::Endpoint>
{
@@ -176,6 +175,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestUnixStreamChannel
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/unix-stream-factory.t.cpp b/tests/daemon/face/unix-stream-factory.t.cpp
index dd6f5cf..2554b25 100644
--- a/tests/daemon/face/unix-stream-factory.t.cpp
+++ b/tests/daemon/face/unix-stream-factory.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, 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,17 +28,17 @@
#include "face-system-fixture.hpp"
#include "factory-test-common.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using face::UnixStreamFactory;
using UnixStreamFactoryFixture = FaceSystemFactoryFixture<UnixStreamFactory>;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestUnixStreamFactory, UnixStreamFactoryFixture)
-static const std::string CHANNEL_PATH1("unix-stream-test.1.sock");
-static const std::string CHANNEL_PATH2("unix-stream-test.2.sock");
+const std::string CHANNEL_PATH1("unix-stream-test.1.sock");
+const std::string CHANNEL_PATH2("unix-stream-test.2.sock");
BOOST_AUTO_TEST_SUITE(ProcessConfig)
@@ -145,6 +145,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestUnixStreamFactory
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/unix-stream-transport-fixture.hpp b/tests/daemon/face/unix-stream-transport-fixture.hpp
index 6724085..9603247 100644
--- a/tests/daemon/face/unix-stream-transport-fixture.hpp
+++ b/tests/daemon/face/unix-stream-transport-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,
@@ -35,14 +35,13 @@
#include <boost/filesystem.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
-using namespace nfd::tests;
-typedef boost::asio::local::stream_protocol unix_stream;
+using unix_stream = boost::asio::local::stream_protocol;
+using face::UnixStreamTransport;
-/** \brief automatically unlinks the socket file of a Unix stream acceptor
+/**
+ * \brief Automatically unlinks the socket file of a Unix stream acceptor
*/
class AcceptorWithCleanup : public unix_stream::acceptor
{
@@ -117,7 +116,7 @@
transport = static_cast<UnixStreamTransport*>(face->getTransport());
receivedPackets = &static_cast<DummyLinkService*>(face->getLinkService())->receivedPackets;
- BOOST_REQUIRE_EQUAL(transport->getState(), TransportState::UP);
+ BOOST_REQUIRE_EQUAL(transport->getState(), face::TransportState::UP);
}
void
@@ -144,8 +143,6 @@
unique_ptr<Face> face;
};
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_UNIX_STREAM_TRANSPORT_FIXTURE_HPP
diff --git a/tests/daemon/face/unix-stream-transport.t.cpp b/tests/daemon/face/unix-stream-transport.t.cpp
index 8eebb60..41acb0b 100644
--- a/tests/daemon/face/unix-stream-transport.t.cpp
+++ b/tests/daemon/face/unix-stream-transport.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, 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,
@@ -27,9 +27,9 @@
#include "unix-stream-transport-fixture.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestUnixStreamTransport, UnixStreamTransportFixture)
@@ -63,6 +63,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestUnixStreamTransport
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/websocket-channel-fixture.hpp b/tests/daemon/face/websocket-channel-fixture.hpp
index 62c717b..dc9a232 100644
--- a/tests/daemon/face/websocket-channel-fixture.hpp
+++ b/tests/daemon/face/websocket-channel-fixture.hpp
@@ -30,9 +30,9 @@
#include "channel-fixture.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using face::WebSocketChannel;
class WebSocketChannelFixture : public ChannelFixture<WebSocketChannel, websocket::Endpoint>
{
@@ -153,8 +153,6 @@
time::steady_clock::time_point m_prevPingRecvTime;
};
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_WEBSOCKET_CHANNEL_FIXTURE_HPP
diff --git a/tests/daemon/face/websocket-channel.t.cpp b/tests/daemon/face/websocket-channel.t.cpp
index 5772daa..a396530 100644
--- a/tests/daemon/face/websocket-channel.t.cpp
+++ b/tests/daemon/face/websocket-channel.t.cpp
@@ -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,
@@ -30,9 +30,7 @@
#include <boost/mpl/vector.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestWebSocketChannel, WebSocketChannelFixture)
@@ -199,9 +197,9 @@
2_s), LimitedIo::EXCEED_OPS);
BOOST_CHECK_EQUAL(listenerChannel->size(), 0);
- auto transport = static_cast<WebSocketTransport*>(listenerFaces.at(0)->getTransport());
- BOOST_CHECK(transport->getState() == TransportState::FAILED ||
- transport->getState() == TransportState::CLOSED);
+ auto transport = static_cast<face::WebSocketTransport*>(listenerFaces.at(0)->getTransport());
+ BOOST_CHECK(transport->getState() == face::TransportState::FAILED ||
+ transport->getState() == face::TransportState::CLOSED);
BOOST_CHECK_GE(transport->getCounters().nOutPings, 1);
BOOST_CHECK_LE(transport->getCounters().nOutPings, 2);
BOOST_CHECK_EQUAL(transport->getCounters().nInPongs, 0);
@@ -210,6 +208,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestWebSocketChannel
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/websocket-factory.t.cpp b/tests/daemon/face/websocket-factory.t.cpp
index b684cee..5043d87 100644
--- a/tests/daemon/face/websocket-factory.t.cpp
+++ b/tests/daemon/face/websocket-factory.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, 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,9 +28,10 @@
#include "face-system-fixture.hpp"
#include "factory-test-common.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using face::WebSocketChannel;
+using face::WebSocketFactory;
class WebSocketFactoryFixture : public FaceSystemFactoryFixture<WebSocketFactory>
{
@@ -316,6 +317,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestWebSocketFactory
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/face/websocket-transport-fixture.hpp b/tests/daemon/face/websocket-transport-fixture.hpp
index b1700ed..2e1e61e 100644
--- a/tests/daemon/face/websocket-transport-fixture.hpp
+++ b/tests/daemon/face/websocket-transport-fixture.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,
@@ -33,25 +33,16 @@
#include "tests/daemon/limited-io.hpp"
#include "tests/daemon/face/dummy-link-service.hpp"
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
-using namespace nfd::tests;
namespace ip = boost::asio::ip;
+using face::WebSocketTransport;
/** \brief a fixture that accepts a single WebSocket connection from a client
*/
class WebSocketTransportFixture : public GlobalIoFixture
{
protected:
- WebSocketTransportFixture()
- : transport(nullptr)
- , serverReceivedPackets(nullptr)
- , clientShouldPong(true)
- {
- }
-
/** \brief initialize server and start listening
*/
void
@@ -114,7 +105,7 @@
transport = static_cast<WebSocketTransport*>(face->getTransport());
serverReceivedPackets = &static_cast<DummyLinkService*>(face->getLinkService())->receivedPackets;
- BOOST_REQUIRE_EQUAL(transport->getState(), TransportState::UP);
+ BOOST_REQUIRE_EQUAL(transport->getState(), face::TransportState::UP);
}
private:
@@ -202,20 +193,18 @@
websocket::Server server;
websocketpp::connection_hdl serverHdl;
ip::tcp::endpoint remoteEp;
- WebSocketTransport* transport;
- std::vector<RxPacket>* serverReceivedPackets;
+ WebSocketTransport* transport = nullptr;
+ std::vector<RxPacket>* serverReceivedPackets = nullptr;
websocket::Client client;
websocketpp::connection_hdl clientHdl;
- bool clientShouldPong;
+ bool clientShouldPong = true;
std::vector<std::string> clientReceivedMessages;
private:
unique_ptr<Face> face;
};
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests
#endif // NFD_TESTS_DAEMON_FACE_WEBSOCKET_TRANSPORT_FIXTURE_HPP
diff --git a/tests/daemon/face/websocket-transport.t.cpp b/tests/daemon/face/websocket-transport.t.cpp
index 008a41f..fe79de9 100644
--- a/tests/daemon/face/websocket-transport.t.cpp
+++ b/tests/daemon/face/websocket-transport.t.cpp
@@ -29,9 +29,9 @@
#include <boost/mpl/vector.hpp>
-namespace nfd {
-namespace face {
-namespace tests {
+namespace nfd::tests {
+
+using namespace nfd::face;
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestWebSocketTransport, IpTransportFixture<WebSocketTransportFixture>)
@@ -260,6 +260,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestWebSocketTransport
BOOST_AUTO_TEST_SUITE_END() // Face
-} // namespace tests
-} // namespace face
-} // namespace nfd
+} // namespace nfd::tests