Migrate to C++17 and refactor

Change-Id: I53407266939258990a1c3a9363c3ebe9ea113fd2
diff --git a/tests/database-fixture.hpp b/tests/database-fixture.hpp
index 53f813e..283ae2b 100644
--- a/tests/database-fixture.hpp
+++ b/tests/database-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -27,8 +27,7 @@
 
 #include <boost/filesystem.hpp>
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 class IdentityManagementTimeFixture : public UnitTestTimeFixture
                                     , public IdentityManagementFixture
@@ -56,7 +55,6 @@
   boost::filesystem::path dbDir;
 };
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
 
 #endif // NDNCERT_TESTS_DATABASE_FIXTURE_HPP
diff --git a/tests/global-configuration.cpp b/tests/global-configuration.cpp
index e526936..bad7caf 100644
--- a/tests/global-configuration.cpp
+++ b/tests/global-configuration.cpp
@@ -26,8 +26,7 @@
 #include <fstream>
 #include <stdlib.h>
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 class GlobalConfiguration
 {
@@ -63,5 +62,4 @@
 
 BOOST_TEST_GLOBAL_CONFIGURATION(GlobalConfiguration);
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/identity-management-fixture.cpp b/tests/identity-management-fixture.cpp
index 254da23..86655c4 100644
--- a/tests/identity-management-fixture.cpp
+++ b/tests/identity-management-fixture.cpp
@@ -26,8 +26,7 @@
 
 #include <boost/filesystem.hpp>
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 using namespace ndn::security;
 
@@ -126,5 +125,4 @@
   return certificate;
 }
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/identity-management-fixture.hpp b/tests/identity-management-fixture.hpp
index 7856bf9..8c435a4 100644
--- a/tests/identity-management-fixture.hpp
+++ b/tests/identity-management-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -27,8 +27,7 @@
 #include <ndn-cxx/security/key-chain.hpp>
 #include <ndn-cxx/security/signing-helpers.hpp>
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 class IdentityManagementBaseFixture
 {
@@ -98,7 +97,6 @@
   ndn::KeyChain m_keyChain;
 };
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
 
 #endif // NDN_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
diff --git a/tests/unit-test-time-fixture.hpp b/tests/unit-test-time-fixture.hpp
index c497940..0ea3635 100644
--- a/tests/unit-test-time-fixture.hpp
+++ b/tests/unit-test-time-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -28,8 +28,7 @@
 
 #include <boost/asio/io_service.hpp>
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 /** \brief a test fixture that overrides steady clock and system clock
  */
@@ -102,7 +101,6 @@
   boost::asio::io_service io;
 };
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
 
 #endif // NDN_TESTS_UNIT_UNIT_TEST_TIME_FIXTURE_HPP
diff --git a/tests/unit-tests/bench.t.cpp b/tests/unit-tests/bench.t.cpp
index a8098e4..335f448 100644
--- a/tests/unit-tests/bench.t.cpp
+++ b/tests/unit-tests/bench.t.cpp
@@ -22,10 +22,10 @@
 #include "challenge/challenge-pin.hpp"
 #include "detail/info-encoder.hpp"
 #include "requester-request.hpp"
+
 #include "test-common.hpp"
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 BOOST_FIXTURE_TEST_SUITE(Benchmark, IdentityManagementTimeFixture)
 
@@ -167,5 +167,4 @@
 
 BOOST_AUTO_TEST_SUITE_END() // Benchmark
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/unit-tests/ca-memory.t.cpp b/tests/unit-tests/ca-memory.t.cpp
index fd6f9a5..fa1ddd8 100644
--- a/tests/unit-tests/ca-memory.t.cpp
+++ b/tests/unit-tests/ca-memory.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2017-2021, Regents of the University of California.
+ * Copyright (c) 2017-2022, Regents of the University of California.
  *
  * This file is part of ndncert, a certificate management system based on NDN.
  *
@@ -19,11 +19,10 @@
  */
 
 #include "detail/ca-memory.hpp"
-#include "detail/ca-sqlite.hpp"
+
 #include "test-common.hpp"
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 using namespace ca;
 
@@ -94,5 +93,4 @@
 
 BOOST_AUTO_TEST_SUITE_END() // TestCaMemory
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/unit-tests/ca-module.t.cpp b/tests/unit-tests/ca-module.t.cpp
index 3d76678..19f369d 100644
--- a/tests/unit-tests/ca-module.t.cpp
+++ b/tests/unit-tests/ca-module.t.cpp
@@ -24,10 +24,10 @@
 #include "challenge/challenge-pin.hpp"
 #include "detail/info-encoder.hpp"
 #include "requester-request.hpp"
+
 #include "test-common.hpp"
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 using namespace ca;
 using ndn::util::DummyClientFace;
@@ -596,5 +596,4 @@
 
 BOOST_AUTO_TEST_SUITE_END() // TestCaModule
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/unit-tests/ca-sqlite.t.cpp b/tests/unit-tests/ca-sqlite.t.cpp
index c592d47..fcd1348 100644
--- a/tests/unit-tests/ca-sqlite.t.cpp
+++ b/tests/unit-tests/ca-sqlite.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2017-2021, Regents of the University of California.
+ * Copyright (c) 2017-2022, Regents of the University of California.
  *
  * This file is part of ndncert, a certificate management system based on NDN.
  *
@@ -19,10 +19,10 @@
  */
 
 #include "detail/ca-sqlite.hpp"
+
 #include "test-common.hpp"
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 using namespace ca;
 
@@ -131,5 +131,4 @@
 
 BOOST_AUTO_TEST_SUITE_END() // TestCaSqlite
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/unit-tests/challenge-email.t.cpp b/tests/unit-tests/challenge-email.t.cpp
index 1044660..d996d4a 100644
--- a/tests/unit-tests/challenge-email.t.cpp
+++ b/tests/unit-tests/challenge-email.t.cpp
@@ -19,10 +19,10 @@
  */
 
 #include "challenge/challenge-email.hpp"
+
 #include "test-common.hpp"
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 BOOST_FIXTURE_TEST_SUITE(TestChallengeEmail, IdentityManagementFixture)
 
@@ -154,5 +154,4 @@
 
 BOOST_AUTO_TEST_SUITE_END() // TestChallengeEmail
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/unit-tests/challenge-pin.t.cpp b/tests/unit-tests/challenge-pin.t.cpp
index b835089..49e3e29 100644
--- a/tests/unit-tests/challenge-pin.t.cpp
+++ b/tests/unit-tests/challenge-pin.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2017-2021, Regents of the University of California.
+ * Copyright (c) 2017-2022, Regents of the University of California.
  *
  * This file is part of ndncert, a certificate management system based on NDN.
  *
@@ -19,10 +19,10 @@
  */
 
 #include "challenge/challenge-pin.hpp"
+
 #include "test-common.hpp"
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 BOOST_FIXTURE_TEST_SUITE(TestChallengePin, IdentityManagementFixture)
 
@@ -113,5 +113,4 @@
 
 BOOST_AUTO_TEST_SUITE_END() // TestChallengePin
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/unit-tests/challenge-possession.t.cpp b/tests/unit-tests/challenge-possession.t.cpp
index 0a25577..bfc48a6 100644
--- a/tests/unit-tests/challenge-possession.t.cpp
+++ b/tests/unit-tests/challenge-possession.t.cpp
@@ -20,10 +20,10 @@
 
 #include "challenge/challenge-possession.hpp"
 #include "detail/challenge-encoder.hpp"
+
 #include "test-common.hpp"
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 BOOST_FIXTURE_TEST_SUITE(TestChallengePossession, IdentityManagementFixture)
 
@@ -145,5 +145,4 @@
 
 BOOST_AUTO_TEST_SUITE_END() // TestChallengePossession
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/unit-tests/configuration.t.cpp b/tests/unit-tests/configuration.t.cpp
index bb380f9..7d38adc 100644
--- a/tests/unit-tests/configuration.t.cpp
+++ b/tests/unit-tests/configuration.t.cpp
@@ -21,10 +21,10 @@
 #include "detail/ca-configuration.hpp"
 #include "detail/profile-storage.hpp"
 #include "detail/info-encoder.hpp"
+
 #include "test-common.hpp"
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 BOOST_FIXTURE_TEST_SUITE(TestConfig, IdentityManagementFixture)
 
@@ -144,5 +144,4 @@
 
 BOOST_AUTO_TEST_SUITE_END() // TestConfig
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/unit-tests/crypto-helpers.t.cpp b/tests/unit-tests/crypto-helpers.t.cpp
index 008a2f6..e67828f 100644
--- a/tests/unit-tests/crypto-helpers.t.cpp
+++ b/tests/unit-tests/crypto-helpers.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2017-2021, Regents of the University of California.
+ * Copyright (c) 2017-2022, Regents of the University of California.
  *
  * This file is part of ndncert, a certificate management system based on NDN.
  *
@@ -19,10 +19,10 @@
  */
 
 #include "detail/crypto-helpers.hpp"
+
 #include "test-common.hpp"
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 BOOST_AUTO_TEST_SUITE(TestCryptoHelpers)
 
@@ -339,5 +339,4 @@
 
 BOOST_AUTO_TEST_SUITE_END() // TestCryptoHelpers
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/unit-tests/name-assignment.t.cpp b/tests/unit-tests/name-assignment.t.cpp
index cecbc59..da8396a 100644
--- a/tests/unit-tests/name-assignment.t.cpp
+++ b/tests/unit-tests/name-assignment.t.cpp
@@ -22,10 +22,10 @@
 #include "name-assignment/assignment-random.hpp"
 #include "name-assignment/assignment-param.hpp"
 #include "name-assignment/assignment-hash.hpp"
+
 #include "test-common.hpp"
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 BOOST_AUTO_TEST_SUITE(TestNameAssignment)
 
@@ -93,5 +93,4 @@
 
 BOOST_AUTO_TEST_SUITE_END() // TestNameAssignment
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/unit-tests/protocol-encoders.t.cpp b/tests/unit-tests/protocol-encoders.t.cpp
index 720c10e..a569f0e 100644
--- a/tests/unit-tests/protocol-encoders.t.cpp
+++ b/tests/unit-tests/protocol-encoders.t.cpp
@@ -21,13 +21,13 @@
 #include "detail/challenge-encoder.hpp"
 #include "detail/error-encoder.hpp"
 #include "detail/info-encoder.hpp"
-#include "detail/request-encoder.hpp"
 #include "detail/probe-encoder.hpp"
+#include "detail/request-encoder.hpp"
 #include "detail/ca-configuration.hpp"
+
 #include "test-common.hpp"
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 BOOST_FIXTURE_TEST_SUITE(TestProtocolEncoding, IdentityManagementTimeFixture)
 
@@ -172,5 +172,4 @@
 
 BOOST_AUTO_TEST_SUITE_END() // TestProtocolEncoding
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/unit-tests/redirection-policy.t.cpp b/tests/unit-tests/redirection-policy.t.cpp
index d8d5203..bcc0d9f 100644
--- a/tests/unit-tests/redirection-policy.t.cpp
+++ b/tests/unit-tests/redirection-policy.t.cpp
@@ -21,10 +21,10 @@
 #include "redirection/redirection-policy.hpp"
 #include "redirection/redirection-param.hpp"
 #include "redirection/redirection-email.hpp"
+
 #include "test-common.hpp"
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 BOOST_AUTO_TEST_SUITE(TestRedirectionPolicy)
 
@@ -76,5 +76,4 @@
 
 BOOST_AUTO_TEST_SUITE_END() // TestNameAssignment
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests
diff --git a/tests/unit-tests/requester.t.cpp b/tests/unit-tests/requester.t.cpp
index 73da390..858a127 100644
--- a/tests/unit-tests/requester.t.cpp
+++ b/tests/unit-tests/requester.t.cpp
@@ -19,14 +19,14 @@
  */
 
 #include "requester-request.hpp"
+#include "ca-module.hpp"
+#include "challenge/challenge-module.hpp"
 #include "detail/error-encoder.hpp"
 #include "detail/probe-encoder.hpp"
-#include "challenge/challenge-module.hpp"
-#include "ca-module.hpp"
+
 #include "test-common.hpp"
 
-namespace ndncert {
-namespace tests {
+namespace ndncert::tests {
 
 using namespace requester;
 
@@ -128,5 +128,4 @@
 
 BOOST_AUTO_TEST_SUITE_END() // TestRequester
 
-} // namespace tests
-} // namespace ndncert
+} // namespace ndncert::tests