Eradicate all uses of std::bind()
Change-Id: I6e1ccf2d87b76142e6d519c1a288d03022e4d167
diff --git a/tests/ping/client/ping.t.cpp b/tests/ping/client/ping.t.cpp
index cef62d6..a0eb163 100644
--- a/tests/ping/client/ping.t.cpp
+++ b/tests/ping/client/ping.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Arizona Board of Regents.
+ * Copyright (c) 2014-2021, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -32,9 +32,9 @@
using namespace ndn::tests;
BOOST_AUTO_TEST_SUITE(Ping)
-BOOST_AUTO_TEST_SUITE(TestPing)
+BOOST_AUTO_TEST_SUITE(TestClient)
-using ping::client::Ping;
+using client::Ping;
BOOST_FIXTURE_TEST_CASE(Basic, IoFixture)
{
@@ -55,10 +55,10 @@
std::vector<uint64_t> nackSeqs;
std::vector<uint64_t> timeoutSeqs;
- ping.afterData.connect(bind([&] (uint64_t seq) { dataSeqs.push_back(seq); }, _1));
- ping.afterNack.connect(bind([&] (uint64_t seq) { nackSeqs.push_back(seq); }, _1));
- ping.afterTimeout.connect(bind([&] (uint64_t seq) { timeoutSeqs.push_back(seq); }, _1));
- ping.afterFinish.connect(bind([&] {
+ ping.afterData.connect([&] (uint64_t seq, auto&&...) { dataSeqs.push_back(seq); });
+ ping.afterNack.connect([&] (uint64_t seq, auto&&...) { nackSeqs.push_back(seq); });
+ ping.afterTimeout.connect([&] (uint64_t seq, auto&&...) { timeoutSeqs.push_back(seq); });
+ ping.afterFinish.connect([&] {
BOOST_REQUIRE_EQUAL(dataSeqs.size(), 2);
BOOST_REQUIRE_EQUAL(nackSeqs.size(), 1);
BOOST_REQUIRE_EQUAL(timeoutSeqs.size(), 1);
@@ -69,7 +69,7 @@
BOOST_CHECK_EQUAL(timeoutSeqs[0], 1003);
nFinishSignals++;
- }));
+ });
ping.start();
@@ -93,7 +93,7 @@
BOOST_CHECK_EQUAL(nFinishSignals, 1);
}
-BOOST_AUTO_TEST_SUITE_END() // TestPing
+BOOST_AUTO_TEST_SUITE_END() // TestClient
BOOST_AUTO_TEST_SUITE_END() // Ping
} // namespace tests
diff --git a/tests/ping/server/ping-server.t.cpp b/tests/ping/server/ping-server.t.cpp
index f7ff66f..e01d3d7 100644
--- a/tests/ping/server/ping-server.t.cpp
+++ b/tests/ping/server/ping-server.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Arizona Board of Regents.
+ * Copyright (c) 2014-2021, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -33,12 +33,12 @@
using namespace ndn::tests;
BOOST_AUTO_TEST_SUITE(Ping)
-BOOST_AUTO_TEST_SUITE(TestPingServer)
+BOOST_AUTO_TEST_SUITE(TestServer)
-class CreatePingServerFixture : public IoFixture, public KeyChainFixture
+class PingServerFixture : public IoFixture, public KeyChainFixture
{
protected:
- CreatePingServerFixture()
+ PingServerFixture()
: face(m_io, m_keyChain, {false, true})
, pingOptions(makeOptions())
, pingServer(face, m_keyChain, pingOptions)
@@ -78,9 +78,9 @@
PingServer pingServer;
};
-BOOST_FIXTURE_TEST_CASE(CreatePingServer, CreatePingServerFixture)
+BOOST_FIXTURE_TEST_CASE(Receive, PingServerFixture)
{
- BOOST_REQUIRE_EQUAL(0, pingServer.getNPings());
+ BOOST_TEST(pingServer.getNPings() == 0);
pingServer.start();
advanceClocks(1_ms, 200);
@@ -90,10 +90,10 @@
m_io.run();
- BOOST_CHECK_EQUAL(2, pingServer.getNPings());
+ BOOST_TEST(pingServer.getNPings() == 2);
}
-BOOST_AUTO_TEST_SUITE_END() // TestPingServer
+BOOST_AUTO_TEST_SUITE_END() // TestServer
BOOST_AUTO_TEST_SUITE_END() // Ping
} // namespace tests