build: switch to C++17

Change-Id: Id6217b5c993f3e4726e89773128b565e5f136bb6
diff --git a/tests/ping/client/ping.t.cpp b/tests/ping/client/ping.t.cpp
index a0eb163..a008271 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-2021,  Arizona Board of Regents.
+ * Copyright (c) 2014-2022,  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.
@@ -24,10 +24,7 @@
 
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
-namespace ndn {
-namespace ping {
-namespace client {
-namespace tests {
+namespace ndn::ping::client::tests {
 
 using namespace ndn::tests;
 
@@ -96,7 +93,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestClient
 BOOST_AUTO_TEST_SUITE_END() // Ping
 
-} // namespace tests
-} // namespace client
-} // namespace ping
-} // namespace ndn
+} // namespace ndn::ping::client::tests
diff --git a/tests/ping/client/statistics-collector.t.cpp b/tests/ping/client/statistics-collector.t.cpp
index 270c576..9d5423a 100644
--- a/tests/ping/client/statistics-collector.t.cpp
+++ b/tests/ping/client/statistics-collector.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  Arizona Board of Regents.
+/*
+ * Copyright (c) 2014-2022,  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.
@@ -20,46 +20,34 @@
 #include "tools/ping/client/statistics-collector.hpp"
 
 #include "tests/test-common.hpp"
+
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
-namespace ndn {
-namespace ping {
-namespace client {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::ping::client::tests {
 
 class StatisticsCollectorFixture
 {
-protected:
-  StatisticsCollectorFixture()
-    : pingOptions(makeOptions())
-    , pingProgram(face, pingOptions)
-    , sc(pingProgram, pingOptions)
-  {
-  }
-
 private:
   static Options
   makeOptions()
   {
     Options opt;
-    opt.prefix = "ndn:/ping-prefix";
+    opt.prefix = "/ping-prefix";
     opt.shouldAllowStaleData = false;
     opt.shouldGenerateRandomSeq = false;
     opt.shouldPrintTimestamp = false;
     opt.nPings = 5;
-    opt.interval = time::milliseconds(100);
-    opt.timeout = time::milliseconds(2000);
+    opt.interval = 100_ms;
+    opt.timeout = 2_s;
     opt.startSeq = 1;
     return opt;
   }
 
 protected:
   util::DummyClientFace face;
-  Options pingOptions;
-  Ping pingProgram;
-  StatisticsCollector sc;
+  Options pingOptions{makeOptions()};
+  Ping pingProgram{face, pingOptions};
+  StatisticsCollector sc{pingProgram, pingOptions};
 };
 
 BOOST_AUTO_TEST_SUITE(Ping)
@@ -211,7 +199,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestStatisticsCollector
 BOOST_AUTO_TEST_SUITE_END() // Ping
 
-} // namespace tests
-} // namespace client
-} // namespace ping
-} // namespace ndn
+} // namespace ndn::ping::client::tests
diff --git a/tests/ping/integrated.t.cpp b/tests/ping/integrated.t.cpp
index eafc52b..0b95ba3 100644
--- a/tests/ping/integrated.t.cpp
+++ b/tests/ping/integrated.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2015-2020,  Arizona Board of Regents.
+ * Copyright (c) 2015-2022,  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.
@@ -26,53 +26,60 @@
 
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
-namespace ndn {
-namespace ping {
-namespace tests {
+namespace ndn::ping::tests {
 
 using namespace ndn::tests;
 
 class PingIntegratedFixture : public IoFixture, public KeyChainFixture
 {
-public:
+protected:
   PingIntegratedFixture()
-    : serverFace(m_io, m_keyChain, {false, true})
-    , clientFace(m_io, m_keyChain, {false, true})
-    , wantLoss(false)
   {
-    serverFace.onSendInterest.connect([this] (const Interest& interest) {
-      m_io.post([=] { if (!wantLoss) { clientFace.receive(interest); } });
+    serverFace.onSendInterest.connect([this] (const auto& interest) {
+      receive(clientFace, interest);
     });
-    clientFace.onSendInterest.connect([this] (const Interest& interest) {
-      m_io.post([=] { if (!wantLoss) { serverFace.receive(interest); } });
+    clientFace.onSendInterest.connect([this] (const auto& interest) {
+      receive(serverFace, interest);
     });
-    serverFace.onSendData.connect([this] (const Data& data) {
-      m_io.post([=] { if (!wantLoss) { clientFace.receive(data); } });
+    serverFace.onSendData.connect([this] (const auto& data) {
+      receive(clientFace, data);
     });
-    clientFace.onSendData.connect([this] (const Data& data) {
-      m_io.post([=] { if (!wantLoss) { serverFace.receive(data); } });
+    clientFace.onSendData.connect([this] (const auto& data) {
+      receive(serverFace, data);
     });
   }
 
-  void onFinish()
+  template<typename Packet>
+  void
+  receive(util::DummyClientFace& face, const Packet& pkt)
+  {
+    m_io.post([=, &face] {
+      if (!wantLoss) {
+        face.receive(pkt);
+      }
+    });
+  }
+
+  void
+  onFinish()
   {
     serverFace.shutdown();
     clientFace.shutdown();
     m_io.stop();
   }
 
-public:
-  util::DummyClientFace serverFace;
-  util::DummyClientFace clientFace;
+protected:
+  util::DummyClientFace serverFace{m_io, m_keyChain, {false, true}};
+  util::DummyClientFace clientFace{m_io, m_keyChain, {false, true}};
   std::unique_ptr<server::PingServer> server;
   std::unique_ptr<client::Ping> client;
-  bool wantLoss;
+  bool wantLoss = false;
 };
 
 BOOST_AUTO_TEST_SUITE(Ping)
-BOOST_AUTO_TEST_SUITE(TestIntegrated)
+BOOST_FIXTURE_TEST_SUITE(TestIntegrated, PingIntegratedFixture)
 
-BOOST_FIXTURE_TEST_CASE(Normal, PingIntegratedFixture)
+BOOST_AUTO_TEST_CASE(Normal)
 {
   server::Options serverOpts;
   serverOpts.prefix = "ndn:/test-prefix";
@@ -103,7 +110,7 @@
   BOOST_CHECK_EQUAL(4, server->getNPings());
 }
 
-BOOST_FIXTURE_TEST_CASE(Timeout, PingIntegratedFixture)
+BOOST_AUTO_TEST_CASE(Timeout)
 {
   wantLoss = true;
 
@@ -139,6 +146,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestIntegrated
 BOOST_AUTO_TEST_SUITE_END() // Ping
 
-} // namespace tests
-} // namespace ping
-} // namespace ndn
+} // namespace ndn::ping::tests
diff --git a/tests/ping/server/ping-server.t.cpp b/tests/ping/server/ping-server.t.cpp
index e01d3d7..b5c9948 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-2021,  Arizona Board of Regents.
+ * Copyright (c) 2014-2022,  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.
@@ -25,26 +25,13 @@
 
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
-namespace ndn {
-namespace ping {
-namespace server {
-namespace tests {
+namespace ndn::ping::server::tests {
 
 using namespace ndn::tests;
 
-BOOST_AUTO_TEST_SUITE(Ping)
-BOOST_AUTO_TEST_SUITE(TestServer)
-
 class PingServerFixture : public IoFixture, public KeyChainFixture
 {
 protected:
-  PingServerFixture()
-    : face(m_io, m_keyChain, {false, true})
-    , pingOptions(makeOptions())
-    , pingServer(face, m_keyChain, pingOptions)
-  {
-  }
-
   Interest
   makePingInterest(int seq) const
   {
@@ -53,7 +40,6 @@
         .append(to_string(seq));
 
     return Interest(name)
-           .setCanBePrefix(false)
            .setMustBeFresh(true)
            .setInterestLifetime(2_s);
   }
@@ -73,11 +59,14 @@
   }
 
 protected:
-  util::DummyClientFace face;
-  Options pingOptions;
-  PingServer pingServer;
+  util::DummyClientFace face{m_io, m_keyChain, {false, true}};
+  Options pingOptions{makeOptions()};
+  PingServer pingServer{face, m_keyChain, pingOptions};
 };
 
+BOOST_AUTO_TEST_SUITE(Ping)
+BOOST_AUTO_TEST_SUITE(TestServer)
+
 BOOST_FIXTURE_TEST_CASE(Receive, PingServerFixture)
 {
   BOOST_TEST(pingServer.getNPings() == 0);
@@ -96,7 +85,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestServer
 BOOST_AUTO_TEST_SUITE_END() // Ping
 
-} // namespace tests
-} // namespace server
-} // namespace ping
-} // namespace ndn
+} // namespace ndn::ping::server::tests