Migrate to C++17 and refactor

Change-Id: I53407266939258990a1c3a9363c3ebe9ea113fd2
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