build: migrate to C++17

Change-Id: Ic66b1703fc7d1d51d61c442de859e0921c0bdd7a
diff --git a/tests/clock-fixture.cpp b/tests/clock-fixture.cpp
index 0b4e04a..d47f695 100644
--- a/tests/clock-fixture.cpp
+++ b/tests/clock-fixture.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013-2020  Regents of the University of California
+ * Copyright (c) 2013-2022  Regents of the University of California
  *                          The University of Memphis
  *
  * This file is part of PSync.
@@ -19,8 +19,7 @@
 
 #include "tests/clock-fixture.hpp"
 
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
 
 ClockFixture::ClockFixture()
   : m_steadyClock(make_shared<time::UnitTestSteadyClock>())
@@ -50,5 +49,4 @@
   }
 }
 
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/clock-fixture.hpp b/tests/clock-fixture.hpp
index c340526..6f79950 100644
--- a/tests/clock-fixture.hpp
+++ b/tests/clock-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013-2020  Regents of the University of California
+ * Copyright (c) 2013-2022  Regents of the University of California
  *                          The University of Memphis
  *
  * This file is part of PSync.
@@ -22,8 +22,7 @@
 
 #include <ndn-cxx/util/time-unit-test-clock.hpp>
 
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
 
 /** \brief A test fixture that overrides steady clock and system clock.
  */
@@ -77,7 +76,6 @@
   shared_ptr<time::UnitTestSystemClock> m_systemClock;
 };
 
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
 
 #endif // PSYNC_TESTS_CLOCK_FIXTURE_HPP
diff --git a/tests/io-fixture.hpp b/tests/io-fixture.hpp
index d15a8ed..cdd2713 100644
--- a/tests/io-fixture.hpp
+++ b/tests/io-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
 /*
- * Copyright (c) 2013-2020  Regents of the University of California
+ * Copyright (c) 2013-2022  Regents of the University of California
  *                          The University of Memphis
  *
  * This file is part of PSync.
@@ -24,8 +24,7 @@
 
 #include <boost/asio/io_service.hpp>
 
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
 
 class IoFixture : public ClockFixture
 {
@@ -47,7 +46,6 @@
   boost::asio::io_service m_io;
 };
 
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
 
 #endif // PSYNC_TESTS_IO_FIXTURE_HPP
diff --git a/tests/test-full-sync.cpp b/tests/test-full-sync.cpp
index d3d9e03..16ba4bc 100644
--- a/tests/test-full-sync.cpp
+++ b/tests/test-full-sync.cpp
@@ -30,7 +30,6 @@
 namespace psync {
 
 using ndn::Name;
-using ndn::optional;
 using ndn::util::DummyClientFace;
 
 class FullSyncFixture : public ndn::tests::IoFixture
@@ -99,7 +98,7 @@
    * @param seq expected sequence number.
    */
   void
-  batchCheck(int id, int origin, int min, int max, optional<uint64_t> seq)
+  batchCheck(int id, int origin, int min, int max, std::optional<uint64_t> seq)
   {
     uint64_t expected = seq.value_or(NOT_EXIST);
     FullProducer& node = *nodes.at(id);
@@ -170,15 +169,13 @@
 
 protected:
   const Name syncPrefix = "/psync";
-  static const int MAX_NODES = 4;
+  static constexpr int MAX_NODES = 4;
   std::array<std::shared_ptr<DummyClientFace>, MAX_NODES> faces;
   std::array<Name, MAX_NODES> userPrefixes;
   std::array<std::shared_ptr<FullProducer>, MAX_NODES> nodes;
-  static const uint64_t NOT_EXIST = std::numeric_limits<uint64_t>::max();
+  static constexpr uint64_t NOT_EXIST = std::numeric_limits<uint64_t>::max();
 };
 
-const uint64_t FullSyncFixture::NOT_EXIST;
-
 BOOST_FIXTURE_TEST_SUITE(TestFullSync, FullSyncFixture)
 
 BOOST_AUTO_TEST_CASE(TwoNodesSimple)
diff --git a/tests/test-iblt.cpp b/tests/test-iblt.cpp
index 1f00564..e5ce12f 100644
--- a/tests/test-iblt.cpp
+++ b/tests/test-iblt.cpp
@@ -91,9 +91,7 @@
   iblt2.insert(hash);
   Name ibltName2("/sync");
   iblt2.appendToName(ibltName2);
-  BOOST_CHECK_EQUAL_COLLECTIONS(IBF, IBF + sizeof(IBF),
-                                ibltName2.at(-1).wireEncode().begin(),
-                                ibltName2.at(-1).wireEncode().end());
+  BOOST_TEST(ibltName2.at(-1).wireEncode() == IBF, boost::test_tools::per_element());
 
   Name malformedName("/test");
   auto compressed = compress(CompressionScheme::DEFAULT,
diff --git a/tests/test-partial-sync.cpp b/tests/test-partial-sync.cpp
index 6235310..7353c5e 100644
--- a/tests/test-partial-sync.cpp
+++ b/tests/test-partial-sync.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020,  The University of Memphis
+ * Copyright (c) 2014-2022,  The University of Memphis
  *
  * This file is part of PSync.
  * See AUTHORS.md for complete list of PSync authors and contributors.
@@ -112,7 +112,7 @@
   {
     // zeroth is added through constructor
     for (int i = 1; i < numOfUserNodes; i++) {
-      producer->addUserNode(prefix + "-" + to_string(i));
+      producer->addUserNode(prefix + "-" + std::to_string(i));
     }
   }
 
@@ -291,7 +291,7 @@
   util::DummyClientFace face2(m_io, {true, true});
   PartialProducer replicatedProducer(40, face2, syncPrefix, userPrefix);
   for (int i = 1; i < 10; i++) {
-      replicatedProducer.addUserNode("testUser-" + to_string(i));
+      replicatedProducer.addUserNode("testUser-" + std::to_string(i));
   }
   advanceClocks(ndn::time::milliseconds(10));
   replicatedProducer.publishName("testUser-2");
@@ -326,7 +326,7 @@
 
   oldSeqMap = producer->m_prefixes;
   for (int i = 0; i < 50; i++) {
-    Name prefix("testUser-" + to_string(i));
+    Name prefix("testUser-" + std::to_string(i));
     producer->updateSeqNo(prefix, producer->getSeqNo(prefix).value() + 1);
   }
   // Next sync interest should trigger the nack
@@ -387,7 +387,7 @@
 
   std::vector<std::string> subscribeTo;
   for (int i = 1; i < 10; i++) {
-    subscribeTo.push_back(longNameToExceedDataSize.toUri() + "-" + to_string(i));
+    subscribeTo.push_back(longNameToExceedDataSize.toUri() + "-" + std::to_string(i));
   }
   addConsumer(0, subscribeTo);
 
@@ -404,7 +404,7 @@
 
   oldSeqMap = producer->m_prefixes;
   for (int i = 1; i < 10; i++) {
-    producer->updateSeqNo(longNameToExceedDataSize.toUri() + "-" + to_string(i), 1);
+    producer->updateSeqNo(longNameToExceedDataSize.toUri() + "-" + std::to_string(i), 1);
   }
 
   advanceClocks(ndn::time::milliseconds(999));
diff --git a/tests/test-producer-base.cpp b/tests/test-producer-base.cpp
index 30cf4c3..deab560 100644
--- a/tests/test-producer-base.cpp
+++ b/tests/test-producer-base.cpp
@@ -34,7 +34,7 @@
 BOOST_AUTO_TEST_CASE(Constructor)
 {
   util::DummyClientFace face;
-  BOOST_REQUIRE_NO_THROW(ProducerBase(40, face, Name("/psync"), Name("/testUser")));
+  BOOST_CHECK_NO_THROW(ProducerBase(40, face, Name("/psync"), Name("/testUser")));
 }
 
 BOOST_AUTO_TEST_CASE(Basic)
@@ -55,7 +55,7 @@
   BOOST_CHECK_EQUAL(prefix.getPrefix(-1), userNode);
 
   producerBase.removeUserNode(userNode);
-  BOOST_CHECK(producerBase.getSeqNo(userNode) == nullopt);
+  BOOST_CHECK(producerBase.getSeqNo(userNode) == std::nullopt);
   BOOST_CHECK(producerBase.m_biMap.right.find(prefixWithSeq) == producerBase.m_biMap.right.end());
   BOOST_CHECK(producerBase.m_biMap.left.find(hash) == producerBase.m_biMap.left.end());