Reduce usage of std::bind()
C++14 lambdas are easier to read, easier to debug,
and can usually be better optimized by the compiler.
Change-Id: I294f275904f91942a8de946fe63e77078a7608a6
diff --git a/tests/daemon/common/config-file.t.cpp b/tests/daemon/common/config-file.t.cpp
index c24e335..e1c7333 100644
--- a/tests/daemon/common/config-file.t.cpp
+++ b/tests/daemon/common/config-file.t.cpp
@@ -106,8 +106,8 @@
DummyAllSubscriber(ConfigFile& config, bool expectDryRun = false)
: DummySubscriber(config, CONFIG_N_A_SECTIONS, CONFIG_N_B_SECTIONS, expectDryRun)
{
- config.addSectionHandler("a", bind(&DummySubscriber::onA, this, _1, _2));
- config.addSectionHandler("b", bind(&DummySubscriber::onB, this, _1, _2));
+ config.addSectionHandler("a", std::bind(&DummySubscriber::onA, this, _1, _2));
+ config.addSectionHandler("b", std::bind(&DummySubscriber::onB, this, _1, _2));
}
};
@@ -121,10 +121,10 @@
expectDryRun)
{
if (sectionName == "a") {
- config.addSectionHandler(sectionName, bind(&DummySubscriber::onA, this, _1, _2));
+ config.addSectionHandler(sectionName, std::bind(&DummySubscriber::onA, this, _1, _2));
}
else if (sectionName == "b") {
- config.addSectionHandler(sectionName, bind(&DummySubscriber::onB, this, _1, _2));
+ config.addSectionHandler(sectionName, std::bind(&DummySubscriber::onB, this, _1, _2));
}
else {
BOOST_FAIL("Test setup error: Unexpected section name '" << sectionName << "'");
@@ -304,8 +304,8 @@
ConfigFile file;
BOOST_REQUIRE_THROW(file.parse(CONFIG, false, "dummy-config"), ConfigFile::Error);
- ConfigFile permissiveFile(bind(&MissingCallbackFixture::checkMissingHandler,
- this, _1, _2, _3, _4));
+ ConfigFile permissiveFile(std::bind(&MissingCallbackFixture::checkMissingHandler,
+ this, _1, _2, _3, _4));
DummyOneSubscriber subA(permissiveFile, "a");
BOOST_REQUIRE_NO_THROW(permissiveFile.parse(CONFIG, false, "dummy-config"));
diff --git a/tests/daemon/face/face.t.cpp b/tests/daemon/face/face.t.cpp
index b592a24..641088f 100644
--- a/tests/daemon/face/face.t.cpp
+++ b/tests/daemon/face/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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -101,9 +101,9 @@
size_t nReceivedInterests = 0;
size_t nReceivedData = 0;
size_t nReceivedNacks = 0;
- face1->afterReceiveInterest.connect(bind([&nReceivedInterests] { ++nReceivedInterests; }));
- face1->afterReceiveData.connect(bind([&nReceivedData] { ++nReceivedData; }));
- face1->afterReceiveNack.connect(bind([&nReceivedNacks] { ++nReceivedNacks; }));
+ face1->afterReceiveInterest.connect([&] (auto&&...) { ++nReceivedInterests; });
+ face1->afterReceiveData.connect([&] (auto&&...) { ++nReceivedData; });
+ face1->afterReceiveNack.connect([&] (auto&&...) { ++nReceivedNacks; });
for (size_t i = 0; i < nInInterests; ++i) {
face1->receiveInterest(*makeInterest("/JSQdqward4"), 0);
diff --git a/tests/daemon/face/internal-face.t.cpp b/tests/daemon/face/internal-face.t.cpp
index db72bcc..1f2b82a 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-2020, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -87,9 +87,9 @@
bool hasTimeout = false;
clientFace->expressInterest(*interest,
- bind([] { BOOST_ERROR("unexpected Data"); }),
- bind([] { BOOST_ERROR("unexpected Nack"); }),
- bind([&hasTimeout] { hasTimeout = true; }));
+ [] (auto&&...) { BOOST_ERROR("unexpected Data"); },
+ [] (auto&&...) { BOOST_ERROR("unexpected Nack"); },
+ [&] (auto&&...) { hasTimeout = true; });
this->advanceClocks(1_ms, 10);
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
@@ -106,12 +106,12 @@
bool hasReceivedData = false;
clientFace->expressInterest(*interest,
- [&hasReceivedData] (const Interest&, const Data& data) {
+ [&] (const Interest&, const Data& data) {
hasReceivedData = true;
BOOST_CHECK_EQUAL(data.getName(), "/PQstEJGdL/aI7oCrDXNX");
},
- bind([] { BOOST_ERROR("unexpected Nack"); }),
- bind([] { BOOST_ERROR("unexpected timeout"); }));
+ [] (auto&&...) { BOOST_ERROR("unexpected Nack"); },
+ [] (auto&&...) { BOOST_ERROR("unexpected timeout"); });
this->advanceClocks(1_ms, 10);
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
@@ -129,12 +129,12 @@
bool hasReceivedNack = false;
clientFace->expressInterest(*interest,
- bind([] { BOOST_ERROR("unexpected Data"); }),
- [&hasReceivedNack] (const Interest&, const lp::Nack& nack) {
+ [] (auto&&...) { BOOST_ERROR("unexpected Data"); },
+ [&] (const Interest&, const lp::Nack& nack) {
hasReceivedNack = true;
BOOST_CHECK_EQUAL(nack.getReason(), lp::NackReason::NO_ROUTE);
},
- bind([] { BOOST_ERROR("unexpected timeout"); }));
+ [] (auto&&...) { BOOST_ERROR("unexpected timeout"); });
this->advanceClocks(1_ms, 10);
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
@@ -197,9 +197,9 @@
bool hasTimeout = false;
clientFace->expressInterest(*interest,
- bind([] { BOOST_ERROR("unexpected Data"); }),
- bind([] { BOOST_ERROR("unexpected Nack"); }),
- bind([&hasTimeout] { hasTimeout = true; }));
+ [] (auto&&...) { BOOST_ERROR("unexpected Data"); },
+ [] (auto&&...) { BOOST_ERROR("unexpected Nack"); },
+ [&] (auto&&...) { hasTimeout = true; });
BOOST_CHECK_NO_THROW(this->advanceClocks(1_ms, 200));
BOOST_CHECK_EQUAL(receivedInterests.size(), 0);
diff --git a/tests/daemon/face/tcp-factory.t.cpp b/tests/daemon/face/tcp-factory.t.cpp
index 95e6c2b..a6335f9 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-2020, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -458,10 +458,10 @@
{
createChannel("0.0.0.0", "20070");
factory.createFace({FaceUri("tcp4://192.0.2.1:20070"), {}, {}},
- bind(&CreateFaceTimeoutFixture::onFaceCreated, this, _1),
- bind(&CreateFaceTimeoutFixture::onConnectFailed, this, _2));
+ std::bind(&CreateFaceTimeoutFixture::onFaceCreated, this, _1),
+ std::bind(&CreateFaceTimeoutFixture::onConnectFailed, this, _2));
- BOOST_REQUIRE_EQUAL(limitedIo.run(1, 10_s), LimitedIo::EXCEED_OPS);
+ BOOST_CHECK_EQUAL(limitedIo.run(1, 10_s), LimitedIo::EXCEED_OPS);
BOOST_CHECK(face == nullptr);
}
diff --git a/tests/daemon/face/websocket-channel-fixture.hpp b/tests/daemon/face/websocket-channel-fixture.hpp
index 69b2e9b..e6e1e9f 100644
--- a/tests/daemon/face/websocket-channel-fixture.hpp
+++ b/tests/daemon/face/websocket-channel-fixture.hpp
@@ -38,7 +38,8 @@
{
protected:
shared_ptr<WebSocketChannel>
- makeChannel(const boost::asio::ip::address& addr, uint16_t port = 0, optional<size_t> mtu = nullopt) final
+ makeChannel(const boost::asio::ip::address& addr, uint16_t port = 0,
+ optional<size_t> mtu = nullopt) final
{
if (port == 0)
port = getNextPort();
@@ -55,7 +56,7 @@
listenerChannel = makeChannel(addr, 20030);
listenerChannel->setPingInterval(pingInterval);
listenerChannel->setPongTimeout(pongTimeout);
- listenerChannel->listen(bind(&WebSocketChannelFixture::listenerOnFaceCreated, this, _1));
+ listenerChannel->listen(std::bind(&WebSocketChannelFixture::listenerOnFaceCreated, this, _1));
}
void
@@ -65,9 +66,9 @@
client.clear_error_channels(websocketpp::log::elevel::all);
client.init_asio(&g_io);
- client.set_open_handler(bind(&WebSocketChannelFixture::clientHandleOpen, this, _1));
- client.set_message_handler(bind(&WebSocketChannelFixture::clientHandleMessage, this, _1, _2));
- client.set_ping_handler(bind(&WebSocketChannelFixture::clientHandlePing, this, _1, _2));
+ client.set_open_handler(std::bind(&WebSocketChannelFixture::clientHandleOpen, this, _1));
+ client.set_message_handler(std::bind(&WebSocketChannelFixture::clientHandleMessage, this, _1, _2));
+ client.set_ping_handler(std::bind(&WebSocketChannelFixture::clientHandlePing, this, _1, _2));
websocketpp::lib::error_code ec;
auto con = client.get_connection(FaceUri(listenerEp, "ws").toString(), ec);
@@ -100,20 +101,16 @@
listenerOnFaceCreated(const shared_ptr<Face>& newFace)
{
BOOST_REQUIRE(newFace != nullptr);
- newFace->afterReceiveInterest.connect(bind(&WebSocketChannelFixture::faceAfterReceiveInterest, this, _1));
+ newFace->afterReceiveInterest.connect([this] (const auto& interest, const auto&) {
+ faceReceivedInterests.push_back(interest);
+ limitedIo.afterOp();
+ });
connectFaceClosedSignal(*newFace, [this] { limitedIo.afterOp(); });
listenerFaces.push_back(newFace);
limitedIo.afterOp();
}
void
- faceAfterReceiveInterest(const Interest& interest)
- {
- faceReceivedInterests.push_back(interest);
- limitedIo.afterOp();
- }
-
- void
clientHandleOpen(websocketpp::connection_hdl hdl)
{
clientHandle = hdl;
@@ -131,8 +128,8 @@
clientHandlePing(websocketpp::connection_hdl, std::string)
{
auto now = time::steady_clock::now();
- if (m_prevPingRecvTime != time::steady_clock::TimePoint()) {
- measuredPingInterval = now - m_prevPingRecvTime;
+ if (m_prevPingRecvTime != time::steady_clock::time_point()) {
+ measuredPingIntervals.push_back(now - m_prevPingRecvTime);
}
m_prevPingRecvTime = now;
@@ -147,13 +144,13 @@
websocketpp::connection_hdl clientHandle;
std::vector<std::string> clientReceivedMessages;
- time::steady_clock::Duration measuredPingInterval;
+ std::vector<time::nanoseconds> measuredPingIntervals;
// set clientShouldPong to false to disable the pong response,
// which will eventually cause a timeout in listenerChannel
bool clientShouldPong = true;
private:
- time::steady_clock::TimePoint m_prevPingRecvTime;
+ time::steady_clock::time_point m_prevPingRecvTime;
};
} // namespace tests
diff --git a/tests/daemon/face/websocket-channel.t.cpp b/tests/daemon/face/websocket-channel.t.cpp
index d9fe929..5772daa 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-2020, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -175,13 +175,17 @@
{
auto address = getTestIp(F::value, AddressScope::Loopback);
SKIP_IF_IP_UNAVAILABLE(address);
- const auto pingInterval = 1200_ms;
+ const auto pingInterval = 1500_ms;
this->initialize(address, pingInterval);
- BOOST_CHECK_EQUAL(limitedIo.run(2, // clientHandlePing
- pingInterval * 3), LimitedIo::EXCEED_OPS);
- BOOST_CHECK_LE(measuredPingInterval, pingInterval * 1.1);
- BOOST_CHECK_GE(measuredPingInterval, pingInterval * 0.9);
+ BOOST_CHECK_EQUAL(limitedIo.run(5, // clientHandlePing
+ 5 * pingInterval + 1_s), LimitedIo::EXCEED_OPS);
+ BOOST_CHECK_EQUAL(measuredPingIntervals.size(), 4);
+
+ auto avgPingInterval = std::accumulate(measuredPingIntervals.begin(), measuredPingIntervals.end(), 0_ns);
+ avgPingInterval /= measuredPingIntervals.size();
+ BOOST_CHECK_LE(avgPingInterval, pingInterval * 1.1);
+ BOOST_CHECK_GE(avgPingInterval, pingInterval * 0.9);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(SetPongTimeOut, F, AddressFamilies)
diff --git a/tests/daemon/face/websocket-transport-fixture.hpp b/tests/daemon/face/websocket-transport-fixture.hpp
index 32934ab..b1700ed 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-2019, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -62,11 +62,11 @@
server.clear_error_channels(websocketpp::log::elevel::all);
server.init_asio(&g_io);
- server.set_open_handler(bind(&WebSocketTransportFixture::serverHandleOpen, this, _1));
- server.set_close_handler(bind(&WebSocketTransportFixture::serverHandleClose, this));
- server.set_message_handler(bind(&WebSocketTransportFixture::serverHandleMessage, this, _2));
- server.set_pong_handler(bind(&WebSocketTransportFixture::serverHandlePong, this));
- server.set_pong_timeout_handler(bind(&WebSocketTransportFixture::serverHandlePongTimeout, this));
+ server.set_open_handler(std::bind(&WebSocketTransportFixture::serverHandleOpen, this, _1));
+ server.set_close_handler(std::bind(&WebSocketTransportFixture::serverHandleClose, this));
+ server.set_message_handler(std::bind(&WebSocketTransportFixture::serverHandleMessage, this, _2));
+ server.set_pong_handler(std::bind(&WebSocketTransportFixture::serverHandlePong, this));
+ server.set_pong_timeout_handler(std::bind(&WebSocketTransportFixture::serverHandlePongTimeout, this));
server.set_pong_timeout(pongTimeout.count());
server.set_reuse_addr(true);
@@ -84,9 +84,9 @@
client.clear_error_channels(websocketpp::log::elevel::all);
client.init_asio(&g_io);
- client.set_open_handler(bind(&WebSocketTransportFixture::clientHandleOpen, this, _1));
- client.set_message_handler(bind(&WebSocketTransportFixture::clientHandleMessage, this, _2));
- client.set_ping_handler(bind(&WebSocketTransportFixture::clientHandlePing, this));
+ client.set_open_handler(std::bind(&WebSocketTransportFixture::clientHandleOpen, this, _1));
+ client.set_message_handler(std::bind(&WebSocketTransportFixture::clientHandleMessage, this, _2));
+ client.set_ping_handler(std::bind(&WebSocketTransportFixture::clientHandlePing, this));
websocketpp::lib::error_code ec;
auto con = client.get_connection(uri, ec);
diff --git a/tests/daemon/fw/access-strategy.t.cpp b/tests/daemon/fw/access-strategy.t.cpp
index afa73b6..cb55cca 100644
--- a/tests/daemon/fw/access-strategy.t.cpp
+++ b/tests/daemon/fw/access-strategy.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -315,7 +315,7 @@
shared_ptr<Interest> interest1 = makeInterest("ndn:/laptops/A/1");
bool hasData1 = false;
consumer->getClientFace().expressInterest(*interest1,
- bind([&hasData1] { hasData1 = true; }),
+ [&] (auto&&...) { hasData1 = true; },
nullptr, nullptr);
this->advanceClocks(5_ms, 1_s);
BOOST_CHECK_EQUAL(hasData1, true);
@@ -324,9 +324,9 @@
shared_ptr<Interest> interest2a = makeInterest("ndn:/laptops/A/2");
bool hasData2a = false, hasTimeout2a = false;
consumer->getClientFace().expressInterest(*interest2a,
- bind([&hasData2a] { hasData2a = true; }),
+ [&] (auto&&...) { hasData2a = true; },
nullptr,
- bind([&hasTimeout2a] { hasTimeout2a = true; }));
+ [&] (auto&&...) { hasTimeout2a = true; });
producerA->fail();
this->advanceClocks(5_ms, 60_ms);
BOOST_CHECK_EQUAL(hasData2a, false);
@@ -336,7 +336,7 @@
shared_ptr<Interest> interest2b = makeInterest("ndn:/laptops/A/2");
bool hasData2b = false;
consumer->getClientFace().expressInterest(*interest2b,
- bind([&hasData2b] { hasData2b = true; }),
+ [&] (auto&&...) { hasData2b = true; },
nullptr, nullptr);
producerA->recover();
this->advanceClocks(5_ms, 1_s);
@@ -346,7 +346,7 @@
shared_ptr<Interest> interest2c = makeInterest("ndn:/laptops/A/2");
bool hasData2c = false;
consumer->getClientFace().expressInterest(*interest2c,
- bind([&hasData2c] { hasData2c = true; }),
+ [&] (auto&&...) { hasData2c = true; },
nullptr, nullptr);
this->advanceClocks(5_ms, 1_s);
BOOST_CHECK_EQUAL(hasData2c, true);
diff --git a/tests/daemon/fw/algorithm.t.cpp b/tests/daemon/fw/algorithm.t.cpp
index b998ec2..4a86d78 100644
--- a/tests/daemon/fw/algorithm.t.cpp
+++ b/tests/daemon/fw/algorithm.t.cpp
@@ -190,7 +190,7 @@
auto interest = makeInterest("ndn:/c1I7QCtc");
pit::Entry entry(*interest);
- time::steady_clock::TimePoint before = time::steady_clock::now();
+ auto before = time::steady_clock::now();
entry.insertOrUpdateOutRecord(*face1, *interest);
this->advanceClocks(1_s);
diff --git a/tests/daemon/fw/best-route-strategy.t.cpp b/tests/daemon/fw/best-route-strategy.t.cpp
index 5066cca..7293762 100644
--- a/tests/daemon/fw/best-route-strategy.t.cpp
+++ b/tests/daemon/fw/best-route-strategy.t.cpp
@@ -96,7 +96,7 @@
// more often than DEFAULT_MIN_RETX_INTERVAL
scheduler::EventId retxFrom4Evt;
size_t nSentLast = strategy.sendInterestHistory.size();
- time::steady_clock::TimePoint timeSentLast = time::steady_clock::now();
+ auto timeSentLast = time::steady_clock::now();
std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
periodicalRetxFrom4 = [&] {
pitEntry->insertOrUpdateInRecord(*face4, *interest);
diff --git a/tests/daemon/fw/forwarding-hint.t.cpp b/tests/daemon/fw/forwarding-hint.t.cpp
index fe3e51c..da63619 100644
--- a/tests/daemon/fw/forwarding-hint.t.cpp
+++ b/tests/daemon/fw/forwarding-hint.t.cpp
@@ -114,8 +114,8 @@
shared_ptr<TopologyLink> linkAH, linkHT, linkTP, linkHC, linkCS, linkSQ;
shared_ptr<TopologyAppLink> consumerA, producerP, producerQ;
- Delegation delTelia = {10, "/telia/terabits"};
- Delegation delUcla = {20, "/ucla/cs"};
+ ndn::Delegation delTelia = {10, "/telia/terabits"};
+ ndn::Delegation delUcla = {20, "/ucla/cs"};
};
BOOST_FIXTURE_TEST_SUITE(NdnsimTeliaUclaTopology, NdnsimTeliaUclaTopologyFixture)
@@ -128,12 +128,12 @@
// A forwards Interest according to default route, no change to forwarding hint
BOOST_CHECK_EQUAL(linkAH->getFace(nodeA).getCounters().nOutInterests, 1);
const Interest& interestAH = topo.getPcap(linkAH->getFace(nodeA)).sentInterests.at(0);
- BOOST_CHECK_EQUAL(interestAH.getForwardingHint(), DelegationList({delTelia, delUcla}));
+ BOOST_CHECK_EQUAL(interestAH.getForwardingHint(), ndn::DelegationList({delTelia, delUcla}));
// H prefers T, no change to forwarding hint
BOOST_CHECK_EQUAL(linkHT->getFace(nodeH).getCounters().nOutInterests, 1);
const Interest& interestHT = topo.getPcap(linkHT->getFace(nodeH)).sentInterests.at(0);
- BOOST_CHECK_EQUAL(interestHT.getForwardingHint(), DelegationList({delTelia, delUcla}));
+ BOOST_CHECK_EQUAL(interestHT.getForwardingHint(), ndn::DelegationList({delTelia, delUcla}));
// T forwards to P, forwarding hint stripped when Interest reaches producer region
BOOST_CHECK_EQUAL(linkTP->getFace(nodeT).getCounters().nOutInterests, 1);
@@ -157,17 +157,17 @@
// A forwards Interest according to default route, no change to forwarding hint
BOOST_CHECK_EQUAL(linkAH->getFace(nodeA).getCounters().nOutInterests, 1);
const Interest& interestAH = topo.getPcap(linkAH->getFace(nodeA)).sentInterests.at(0);
- BOOST_CHECK_EQUAL(interestAH.getForwardingHint(), DelegationList({delTelia, delUcla}));
+ BOOST_CHECK_EQUAL(interestAH.getForwardingHint(), ndn::DelegationList({delTelia, delUcla}));
// H forwards to C, no change to forwarding hint
BOOST_CHECK_EQUAL(linkHC->getFace(nodeH).getCounters().nOutInterests, 1);
const Interest& interestHC = topo.getPcap(linkHC->getFace(nodeH)).sentInterests.at(0);
- BOOST_CHECK_EQUAL(interestHC.getForwardingHint(), DelegationList({delTelia, delUcla}));
+ BOOST_CHECK_EQUAL(interestHC.getForwardingHint(), ndn::DelegationList({delTelia, delUcla}));
// C forwards to S, no change to forwarding hint
BOOST_CHECK_EQUAL(linkCS->getFace(nodeC).getCounters().nOutInterests, 1);
const Interest& interestCS = topo.getPcap(linkCS->getFace(nodeC)).sentInterests.at(0);
- BOOST_CHECK_EQUAL(interestCS.getForwardingHint(), DelegationList({delTelia, delUcla}));
+ BOOST_CHECK_EQUAL(interestCS.getForwardingHint(), ndn::DelegationList({delTelia, delUcla}));
// S forwards to Q, forwarding hint stripped when Interest reaches producer region
BOOST_CHECK_EQUAL(linkSQ->getFace(nodeS).getCounters().nOutInterests, 1);
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index 90e4b1e..a1656e5 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -176,7 +176,7 @@
// more often than DEFAULT_MIN_RETX_INTERVAL
scheduler::EventId retxFrom4Evt;
size_t nSentLast = strategy.sendInterestHistory.size();
- time::steady_clock::TimePoint timeSentLast = time::steady_clock::now();
+ auto timeSentLast = time::steady_clock::now();
std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
periodicalRetxFrom4 = [&] {
pitEntry->insertOrUpdateInRecord(*face3, *interest);
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index 9b5f588..73db46c 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -261,11 +261,11 @@
ndn::Face& appD = topo.addAppFace("D", nodeD)->getClientFace();
int nNacksA = 0, nNacksD = 0;
- appA.expressInterest(*makeInterest("/P/1"), nullptr, bind([&nNacksA] { ++nNacksA; }), nullptr);
- appD.expressInterest(*makeInterest("/P/1"), nullptr, bind([&nNacksD] { ++nNacksD; }), nullptr);
+ appA.expressInterest(*makeInterest("/P/1"), nullptr, [&] (auto&&...) { ++nNacksA; }, nullptr);
+ appD.expressInterest(*makeInterest("/P/1"), nullptr, [&] (auto&&...) { ++nNacksD; }, nullptr);
this->advanceClocks(1_ms, 5_ms);
- appA.expressInterest(*makeInterest("/P/1"), nullptr, bind([&nNacksA] { ++nNacksA; }), nullptr);
- appD.expressInterest(*makeInterest("/P/1"), nullptr, bind([&nNacksD] { ++nNacksD; }), nullptr);
+ appA.expressInterest(*makeInterest("/P/1"), nullptr, [&] (auto&&...) { ++nNacksA; }, nullptr);
+ appD.expressInterest(*makeInterest("/P/1"), nullptr, [&] (auto&&...) { ++nNacksD; }, nullptr);
this->advanceClocks(1_ms, 100_ms);
// As long as at least one Nack arrives at each client, strategy behavior is correct.
diff --git a/tests/daemon/fw/topology-tester.hpp b/tests/daemon/fw/topology-tester.hpp
index 6e5cb95..842e810 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-2019, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -242,7 +242,7 @@
/** \brief captured packet timestamp tag
*/
-using TopologyPcapTimestamp = ndn::SimpleTag<time::steady_clock::TimePoint, 0>;
+using TopologyPcapTimestamp = ndn::SimpleTag<time::steady_clock::time_point, 0>;
/** \brief builds a topology for forwarding tests
*/
diff --git a/tests/daemon/fw/unsolicited-data-policy.t.cpp b/tests/daemon/fw/unsolicited-data-policy.t.cpp
index bc95d4f..5c8c8ad 100644
--- a/tests/daemon/fw/unsolicited-data-policy.t.cpp
+++ b/tests/daemon/fw/unsolicited-data-policy.t.cpp
@@ -58,8 +58,8 @@
tribool isFound = indeterminate;
cs.find(Interest(data.getFullName()),
- bind([&] { isFound = true; }),
- bind([&] { isFound = false; }));
+ [&] (auto&&...) { isFound = true; },
+ [&] (auto&&...) { isFound = false; });
this->advanceClocks(1_ms);
BOOST_REQUIRE(!indeterminate(isFound));
diff --git a/tests/daemon/mgmt/manager-base.t.cpp b/tests/daemon/mgmt/manager-base.t.cpp
index 858ea40..315bf28 100644
--- a/tests/daemon/mgmt/manager-base.t.cpp
+++ b/tests/daemon/mgmt/manager-base.t.cpp
@@ -88,7 +88,7 @@
BOOST_AUTO_TEST_CASE(RegisterCommandHandler)
{
bool wasCommandHandlerCalled = false;
- auto handler = bind([&] { wasCommandHandlerCalled = true; });
+ auto handler = [&] (auto&&...) { wasCommandHandlerCalled = true; };
m_manager.registerCommandHandler<TestCommandVoidParameters>("test-void", handler);
m_manager.registerCommandHandler<TestCommandRequireName>("test-require-name", handler);
@@ -109,7 +109,7 @@
BOOST_AUTO_TEST_CASE(RegisterStatusDataset)
{
bool isStatusDatasetCalled = false;
- auto handler = bind([&] { isStatusDatasetCalled = true; });
+ auto handler = [&] (auto&&...) { isStatusDatasetCalled = true; };
m_manager.registerStatusDatasetHandler("test-status", handler);
setTopPrefix();
diff --git a/tests/daemon/rib/readvertise/readvertise.t.cpp b/tests/daemon/rib/readvertise/readvertise.t.cpp
index 1988a20..89ae410 100644
--- a/tests/daemon/rib/readvertise/readvertise.t.cpp
+++ b/tests/daemon/rib/readvertise/readvertise.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -104,7 +104,7 @@
public:
struct HistoryEntry
{
- time::steady_clock::TimePoint timestamp;
+ time::steady_clock::time_point timestamp;
Name prefix;
};
@@ -248,7 +248,7 @@
BOOST_REQUIRE_GT(destination->advertiseHistory.size(), 2);
// destination->advertise keeps failing, so interval should increase
- using FloatInterval = time::duration<float, time::steady_clock::Duration::period>;
+ using FloatInterval = time::duration<float, time::steady_clock::duration::period>;
FloatInterval initialInterval = destination->advertiseHistory[1].timestamp -
destination->advertiseHistory[0].timestamp;
FloatInterval lastInterval = initialInterval;
diff --git a/tests/daemon/rib/rib-entry.t.cpp b/tests/daemon/rib/rib-entry.t.cpp
index 70b053a..b946b78 100644
--- a/tests/daemon/rib/rib-entry.t.cpp
+++ b/tests/daemon/rib/rib-entry.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -87,7 +87,7 @@
}
static Route
-makeSimpleRoute(uint64_t faceId, time::steady_clock::Duration expiration)
+makeSimpleRoute(uint64_t faceId, time::nanoseconds expiration)
{
Route route = makeSimpleRoute(faceId);
route.expires = time::steady_clock::now() + expiration;
diff --git a/tests/daemon/table/cs-fixture.hpp b/tests/daemon/table/cs-fixture.hpp
index 4ed5346..9819653 100644
--- a/tests/daemon/table/cs-fixture.hpp
+++ b/tests/daemon/table/cs-fixture.hpp
@@ -80,10 +80,10 @@
std::memcpy(&found, content.value(), sizeof(found));
check(found);
},
- bind([&] {
+ [&] (auto&&...) {
hasResult = true;
check(0);
- }));
+ });
// current Cs::find implementation is synchronous
BOOST_CHECK(hasResult);
diff --git a/tests/daemon/table/network-region-table.t.cpp b/tests/daemon/table/network-region-table.t.cpp
index 12865c6..6ba2678 100644
--- a/tests/daemon/table/network-region-table.t.cpp
+++ b/tests/daemon/table/network-region-table.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -36,7 +36,7 @@
BOOST_AUTO_TEST_CASE(InProducerRegion)
{
- DelegationList fh{{10, "/telia/terabits"}, {20, "/ucla/cs"}};
+ ndn::DelegationList fh{{10, "/telia/terabits"}, {20, "/ucla/cs"}};
NetworkRegionTable nrt1;
nrt1.insert("/verizon");