core: slim down `common.hpp`
Change-Id: I875c35147edd2261fbaa24e809c170d5cd9b94d3
diff --git a/tests/daemon/common/global.t.cpp b/tests/daemon/common/global.t.cpp
index 61556f7..bd3a5f2 100644
--- a/tests/daemon/common/global.t.cpp
+++ b/tests/daemon/common/global.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -52,8 +52,8 @@
BOOST_AUTO_TEST_CASE(ThreadLocalScheduler)
{
- scheduler::Scheduler* s1 = &getScheduler();
- scheduler::Scheduler* s2 = nullptr;
+ ndn::scheduler::Scheduler* s1 = &getScheduler();
+ ndn::scheduler::Scheduler* s2 = nullptr;
std::thread t([&s2] { s2 = &getScheduler(); });
t.join();
diff --git a/tests/daemon/face/ethernet-factory.t.cpp b/tests/daemon/face/ethernet-factory.t.cpp
index d09c7df..785c8ed 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-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -588,7 +588,7 @@
SKIP_IF_ETHERNET_NETIF_COUNT_LT(1);
// Now add a real interface: both channel and multicast face should be created successfully.
- netmon->addInterface(const_pointer_cast<ndn::net::NetworkInterface>(netifs.front()));
+ netmon->addInterface(std::const_pointer_cast<ndn::net::NetworkInterface>(netifs.front()));
BOOST_CHECK_EQUAL(factory.getChannels().size(), 2);
auto etherMcastFaces = this->listEtherMcastFaces();
BOOST_REQUIRE_EQUAL(etherMcastFaces.size(), 1);
@@ -613,7 +613,7 @@
BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
// Add an interface that satisfies only the unicast criteria.
- auto netif = const_pointer_cast<ndn::net::NetworkInterface>(netifs.front());
+ auto netif = std::const_pointer_cast<ndn::net::NetworkInterface>(netifs.front());
netif->setFlags(netif->getFlags() & ~IFF_MULTICAST);
netmon->addInterface(netif);
checkChannelListEqual(factory, {FaceUri::fromDev(netifs.front()->getName()).toString()});
@@ -659,7 +659,7 @@
parseConfig("", false);
g_io.poll();
- netmon->addInterface(const_pointer_cast<ndn::net::NetworkInterface>(netifs.front()));
+ netmon->addInterface(std::const_pointer_cast<ndn::net::NetworkInterface>(netifs.front()));
BOOST_CHECK_EQUAL(factory.getChannels().size(), 0);
BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
}
diff --git a/tests/daemon/face/ethernet-transport-fixture.hpp b/tests/daemon/face/ethernet-transport-fixture.hpp
index ab73795..dc157e8 100644
--- a/tests/daemon/face/ethernet-transport-fixture.hpp
+++ b/tests/daemon/face/ethernet-transport-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -40,7 +40,7 @@
EthernetTransportFixture()
{
if (!netifs.empty()) {
- defaultNetif = const_pointer_cast<ndn::net::NetworkInterface>(netifs.front());
+ defaultNetif = std::const_pointer_cast<ndn::net::NetworkInterface>(netifs.front());
}
}
@@ -52,7 +52,7 @@
{
for (const auto& netif : netifs) {
if (netif->getState() == ndn::net::InterfaceState::RUNNING) {
- return const_pointer_cast<ndn::net::NetworkInterface>(netif);
+ return std::const_pointer_cast<ndn::net::NetworkInterface>(netif);
}
}
diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp
index 55d601c..3d04940 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-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -1188,7 +1188,7 @@
BOOST_CHECK_EQUAL(this->listUdp4McastFaces().size(), 0);
BOOST_CHECK_EQUAL(this->listUdp6McastFaces().size(), 0);
- netmon->addInterface(const_pointer_cast<NetworkInterface>(netifsV4.front()));
+ netmon->addInterface(std::const_pointer_cast<NetworkInterface>(netifsV4.front()));
BOOST_CHECK_EQUAL(this->listUdp4McastFaces().size(), 1);
BOOST_CHECK_LE(this->listUdp6McastFaces().size(), 1);
}
@@ -1211,7 +1211,7 @@
BOOST_CHECK_EQUAL(this->listUdp4McastFaces().size(), 0);
BOOST_CHECK_EQUAL(this->listUdp6McastFaces().size(), 0);
- netmon->addInterface(const_pointer_cast<NetworkInterface>(netifsV6.front()));
+ netmon->addInterface(std::const_pointer_cast<NetworkInterface>(netifsV6.front()));
BOOST_CHECK_LE(this->listUdp4McastFaces().size(), 1);
BOOST_CHECK_EQUAL(this->listUdp6McastFaces().size(), 1);
}
@@ -1278,7 +1278,7 @@
parseConfig("", false);
g_io.poll();
- netmon->addInterface(const_pointer_cast<NetworkInterface>(netifs.front()));
+ netmon->addInterface(std::const_pointer_cast<NetworkInterface>(netifs.front()));
BOOST_CHECK_EQUAL(this->listUdp4McastFaces().size(), 0);
BOOST_CHECK_EQUAL(this->listUdp6McastFaces().size(), 0);
}
diff --git a/tests/daemon/face/unix-stream-transport-fixture.hpp b/tests/daemon/face/unix-stream-transport-fixture.hpp
index 43b1ad0..253e05c 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-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -42,7 +42,7 @@
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
{
@@ -51,28 +51,27 @@
AcceptorWithCleanup(boost::asio::io_context& io, const std::string& path = "")
: unix_stream::acceptor(io)
{
- this->open();
+ open();
if (path.empty()) {
- this->bind("nfd-unix-stream-test." + to_string(time::system_clock::now().time_since_epoch().count()) + ".sock");
+ bind("nfd-unix-stream-test." + std::to_string(time::system_clock::now().time_since_epoch().count()) + ".sock");
}
else {
- this->bind(path);
+ bind(path);
}
- this->listen(1);
+ listen(1);
}
~AcceptorWithCleanup()
{
boost::system::error_code ec;
-
- std::string path = this->local_endpoint(ec).path();
+ std::string path = local_endpoint(ec).path();
if (ec) {
return;
}
- this->close(ec);
+ close(ec);
boost::filesystem::remove(path, ec);
}
};
diff --git a/tests/daemon/fw/best-route-strategy.t.cpp b/tests/daemon/fw/best-route-strategy.t.cpp
index ce408ec..004b4f2 100644
--- a/tests/daemon/fw/best-route-strategy.t.cpp
+++ b/tests/daemon/fw/best-route-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-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -92,7 +92,7 @@
// downstream retransmits frequently, but the strategy should not send Interests
// more often than DEFAULT_MIN_RETX_INTERVAL
- scheduler::EventId retxFrom4Evt;
+ ndn::scheduler::EventId retxFrom4Evt;
size_t nSentLast = strategy.sendInterestHistory.size();
auto timeSentLast = time::steady_clock::now();
std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
diff --git a/tests/daemon/fw/dummy-strategy.hpp b/tests/daemon/fw/dummy-strategy.hpp
index a4cc414..4ce6f40 100644
--- a/tests/daemon/fw/dummy-strategy.hpp
+++ b/tests/daemon/fw/dummy-strategy.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-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,6 +28,8 @@
#include "fw/strategy.hpp"
+#include <limits>
+
namespace nfd::tests {
/**
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index a69c3a5..aa18cdf 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-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-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -173,7 +173,7 @@
// downstream retransmits frequently, but the strategy should not send Interests
// more often than DEFAULT_MIN_RETX_INTERVAL
- scheduler::EventId retxFrom4Evt;
+ ndn::scheduler::EventId retxFrom4Evt;
size_t nSentLast = strategy.sendInterestHistory.size();
auto timeSentLast = time::steady_clock::now();
std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
diff --git a/tests/daemon/fw/random-strategy.t.cpp b/tests/daemon/fw/random-strategy.t.cpp
index ae34b03..d2173b5 100644
--- a/tests/daemon/fw/random-strategy.t.cpp
+++ b/tests/daemon/fw/random-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-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -24,12 +24,13 @@
*/
#include "fw/random-strategy.hpp"
-#include "common/global.hpp"
#include "tests/test-common.hpp"
#include "tests/daemon/face/dummy-face.hpp"
#include "strategy-tester.hpp"
+#include <unordered_map>
+
namespace nfd::tests {
using RandomStrategyTester = StrategyTester<fw::RandomStrategy>;
diff --git a/tests/daemon/fw/topology-tester.hpp b/tests/daemon/fw/topology-tester.hpp
index e82705c..5264306 100644
--- a/tests/daemon/fw/topology-tester.hpp
+++ b/tests/daemon/fw/topology-tester.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -38,6 +38,8 @@
#include <ndn-cxx/face.hpp>
+#include <unordered_map>
+
namespace nfd::tests {
/** \brief Identifies a node (forwarder) in the topology.
diff --git a/tests/daemon/global-io-fixture.hpp b/tests/daemon/global-io-fixture.hpp
index 5422e72..a18a587 100644
--- a/tests/daemon/global-io-fixture.hpp
+++ b/tests/daemon/global-io-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,6 +28,10 @@
#include "tests/clock-fixture.hpp"
+namespace boost::asio {
+class io_context;
+} // namespace boost::asio
+
namespace nfd::tests {
/**
diff --git a/tests/daemon/limited-io.hpp b/tests/daemon/limited-io.hpp
index 123b370..63d5682 100644
--- a/tests/daemon/limited-io.hpp
+++ b/tests/daemon/limited-io.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-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,7 +28,10 @@
#include "tests/daemon/global-io-fixture.hpp"
+#include <ndn-cxx/util/scheduler.hpp>
+
#include <exception>
+#include <limits>
namespace nfd::tests {
@@ -102,7 +105,7 @@
GlobalIoTimeFixture* m_fixture;
StopReason m_reason;
int m_nOpsRemaining = 0;
- scheduler::EventId m_timeout;
+ ndn::scheduler::EventId m_timeout;
std::exception_ptr m_lastException;
bool m_isRunning = false;
};
diff --git a/tests/daemon/mgmt/face-manager-command-fixture.cpp b/tests/daemon/mgmt/face-manager-command-fixture.cpp
index 694870e..0771e8c 100644
--- a/tests/daemon/mgmt/face-manager-command-fixture.cpp
+++ b/tests/daemon/mgmt/face-manager-command-fixture.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-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -44,11 +44,11 @@
"{\n"
" tcp\n"
" {\n"
- " port " + to_string(port) + "\n"
+ " port " + std::to_string(port) + "\n"
" }\n"
" udp\n"
" {\n"
- " port " + to_string(port) + "\n"
+ " port " + std::to_string(port) + "\n"
" mcast no\n"
" }\n"
" ether\n"
diff --git a/tests/daemon/mgmt/face-manager.t.cpp b/tests/daemon/mgmt/face-manager.t.cpp
index d73dc24..458599f 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-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -320,7 +320,7 @@
const size_t nEntries = 42;
std::map<std::string, shared_ptr<TestChannel>> addedChannels;
for (size_t i = 0; i < nEntries; i++) {
- auto channel = factory->addChannel("test" + to_string(i) + "://");
+ auto channel = factory->addChannel("test" + std::to_string(i) + "://");
addedChannels[channel->getUri().toString()] = channel;
}
diff --git a/tests/daemon/mgmt/rib-manager.t.cpp b/tests/daemon/mgmt/rib-manager.t.cpp
index ded13e2..65dcf05 100644
--- a/tests/daemon/mgmt/rib-manager.t.cpp
+++ b/tests/daemon/mgmt/rib-manager.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -446,7 +446,7 @@
BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
BOOST_CHECK_EQUAL(checkResponse(0, command.getName(),
ControlResponse(414, "Route prefix cannot exceed " +
- to_string(Fib::getMaxDepth()) + " components")),
+ std::to_string(Fib::getMaxDepth()) + " components")),
CheckResponseResult::OK);
BOOST_CHECK_EQUAL(m_fibUpdater.updates.size(), 0);
diff --git a/tests/daemon/mgmt/strategy-choice-manager.t.cpp b/tests/daemon/mgmt/strategy-choice-manager.t.cpp
index 4a6e3df..3553cfd 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-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -131,7 +131,7 @@
ControlResponse expectedResp;
expectedResp.setCode(414)
.setText("Prefix has too many components (limit is " +
- to_string(NameTree::getMaxDepth()) + ")");
+ std::to_string(NameTree::getMaxDepth()) + ")");
BOOST_CHECK_EQUAL(checkResponse(0, req.getName(), expectedResp),
CheckResponseResult::OK);
diff --git a/tests/daemon/table/dead-nonce-list.t.cpp b/tests/daemon/table/dead-nonce-list.t.cpp
index 6c6add2..8bf6842 100644
--- a/tests/daemon/table/dead-nonce-list.t.cpp
+++ b/tests/daemon/table/dead-nonce-list.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-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -141,7 +141,7 @@
Name name = "/N";
uint32_t lastNonce = 0;
size_t addNonceBatch = 0;
- scheduler::ScopedEventId addNonceEvent;
+ ndn::scheduler::ScopedEventId addNonceEvent;
};
BOOST_FIXTURE_TEST_CASE(Lifetime, PeriodicalInsertionFixture)