Refactor and modernize namespace declarations

Move all unit tests to namespace nfd::tests

Delete unused header core/algorithm.hpp

Change-Id: I5591f0c5f3bb5db67f8b45fae95471f8a555ca68
diff --git a/tests/daemon/table/cleanup.t.cpp b/tests/daemon/table/cleanup.t.cpp
index b7395a3..1631b9c 100644
--- a/tests/daemon/table/cleanup.t.cpp
+++ b/tests/daemon/table/cleanup.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -30,8 +30,7 @@
 #include "tests/daemon/global-io-fixture.hpp"
 #include "tests/daemon/face/dummy-face.hpp"
 
-namespace nfd {
-namespace tests {
+namespace nfd::tests {
 
 BOOST_AUTO_TEST_SUITE(Table)
 BOOST_FIXTURE_TEST_SUITE(TestCleanup, GlobalIoFixture)
@@ -183,5 +182,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestCleanup
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/table/cs-fixture.hpp b/tests/daemon/table/cs-fixture.hpp
index 82fbb7e..30273d3 100644
--- a/tests/daemon/table/cs-fixture.hpp
+++ b/tests/daemon/table/cs-fixture.hpp
@@ -33,13 +33,9 @@
 
 #include <cstring>
 
-namespace nfd {
-namespace cs {
-namespace tests {
+namespace nfd::tests {
 
-using namespace nfd::tests;
-
-#define CHECK_CS_FIND(expected) find([&] (uint32_t found) { BOOST_CHECK_EQUAL(expected, found); });
+#define CHECK_CS_FIND(expected) find([&] (uint32_t found) { BOOST_CHECK_EQUAL(expected, found); })
 
 class CsFixture : public GlobalIoTimeFixture
 {
@@ -105,8 +101,6 @@
   shared_ptr<Interest> interest;
 };
 
-} // namespace tests
-} // namespace cs
-} // namespace nfd
+} // namespace nfd::tests
 
 #endif // NFD_TESTS_DAEMON_TABLE_CS_FIXTURE_HPP
diff --git a/tests/daemon/table/cs-policy-lru.t.cpp b/tests/daemon/table/cs-policy-lru.t.cpp
index ed4fa7c..ce19f94 100644
--- a/tests/daemon/table/cs-policy-lru.t.cpp
+++ b/tests/daemon/table/cs-policy-lru.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -27,22 +27,20 @@
 
 #include "tests/daemon/table/cs-fixture.hpp"
 
-namespace nfd {
-namespace cs {
-namespace tests {
+namespace nfd::tests {
 
 BOOST_AUTO_TEST_SUITE(Table)
 BOOST_AUTO_TEST_SUITE(TestCsLru)
 
 BOOST_AUTO_TEST_CASE(Registration)
 {
-  std::set<std::string> policyNames = Policy::getPolicyNames();
+  std::set<std::string> policyNames = cs::Policy::getPolicyNames();
   BOOST_CHECK_EQUAL(policyNames.count("lru"), 1);
 }
 
 BOOST_FIXTURE_TEST_CASE(EvictOne, CsFixture)
 {
-  cs.setPolicy(make_unique<LruPolicy>());
+  cs.setPolicy(make_unique<cs::LruPolicy>());
   cs.setLimit(3);
 
   insert(1, "/A");
@@ -84,6 +82,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestCsLru
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace cs
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/table/cs-policy-priority-fifo.t.cpp b/tests/daemon/table/cs-policy-priority-fifo.t.cpp
index c059756..a1c88d0 100644
--- a/tests/daemon/table/cs-policy-priority-fifo.t.cpp
+++ b/tests/daemon/table/cs-policy-priority-fifo.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -27,22 +27,20 @@
 
 #include "tests/daemon/table/cs-fixture.hpp"
 
-namespace nfd {
-namespace cs {
-namespace tests {
+namespace nfd::tests {
 
 BOOST_AUTO_TEST_SUITE(Table)
 BOOST_AUTO_TEST_SUITE(TestCsPriorityFifo)
 
 BOOST_AUTO_TEST_CASE(Registration)
 {
-  std::set<std::string> policyNames = Policy::getPolicyNames();
+  std::set<std::string> policyNames = cs::Policy::getPolicyNames();
   BOOST_CHECK_EQUAL(policyNames.count("priority_fifo"), 1);
 }
 
 BOOST_FIXTURE_TEST_CASE(EvictOne, CsFixture)
 {
-  cs.setPolicy(make_unique<PriorityFifoPolicy>());
+  cs.setPolicy(make_unique<cs::PriorityFifoPolicy>());
   cs.setLimit(3);
 
   insert(1, "/A", [] (Data& data) { data.setFreshnessPeriod(99999_ms); });
@@ -71,7 +69,7 @@
 
 BOOST_FIXTURE_TEST_CASE(Refresh, CsFixture)
 {
-  cs.setPolicy(make_unique<PriorityFifoPolicy>());
+  cs.setPolicy(make_unique<cs::PriorityFifoPolicy>());
   cs.setLimit(3);
 
   insert(1, "/A", [] (Data& data) { data.setFreshnessPeriod(99999_ms); });
@@ -99,6 +97,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestCsPriorityFifo
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace cs
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/table/cs.t.cpp b/tests/daemon/table/cs.t.cpp
index b8e34de..67a5621 100644
--- a/tests/daemon/table/cs.t.cpp
+++ b/tests/daemon/table/cs.t.cpp
@@ -29,9 +29,7 @@
 
 #include <ndn-cxx/lp/tags.hpp>
 
-namespace nfd {
-namespace cs {
-namespace tests {
+namespace nfd::tests {
 
 BOOST_AUTO_TEST_SUITE(Table)
 BOOST_FIXTURE_TEST_SUITE(TestCs, CsFixture)
@@ -275,6 +273,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestCs
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace cs
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/table/dead-nonce-list.t.cpp b/tests/daemon/table/dead-nonce-list.t.cpp
index 44b0bfd..7df4ec8 100644
--- a/tests/daemon/table/dead-nonce-list.t.cpp
+++ b/tests/daemon/table/dead-nonce-list.t.cpp
@@ -29,8 +29,7 @@
 #include "tests/test-common.hpp"
 #include "tests/daemon/global-io-fixture.hpp"
 
-namespace nfd {
-namespace tests {
+namespace nfd::tests {
 
 BOOST_AUTO_TEST_SUITE(Table)
 BOOST_FIXTURE_TEST_SUITE(TestDeadNonceList, GlobalIoFixture)
@@ -193,5 +192,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestDeadNonceList
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/table/fib.t.cpp b/tests/daemon/table/fib.t.cpp
index 1655fac..e0246db 100644
--- a/tests/daemon/table/fib.t.cpp
+++ b/tests/daemon/table/fib.t.cpp
@@ -31,11 +31,9 @@
 #include "tests/daemon/global-io-fixture.hpp"
 #include "tests/daemon/face/dummy-face.hpp"
 
-namespace nfd {
-namespace fib {
-namespace tests {
+namespace nfd::tests {
 
-using namespace nfd::tests;
+using namespace nfd::fib;
 
 BOOST_AUTO_TEST_SUITE(Table)
 BOOST_FIXTURE_TEST_SUITE(TestFib, GlobalIoFixture)
@@ -390,6 +388,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestFib
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace fib
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/table/measurements-accessor.t.cpp b/tests/daemon/table/measurements-accessor.t.cpp
index 67e0623..73ec418 100644
--- a/tests/daemon/table/measurements-accessor.t.cpp
+++ b/tests/daemon/table/measurements-accessor.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2021,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -31,11 +31,7 @@
 #include "tests/daemon/fw/dummy-strategy.hpp"
 #include "tests/daemon/fw/choose-strategy.hpp"
 
-namespace nfd {
-namespace measurements {
-namespace tests {
-
-using namespace nfd::tests;
+namespace nfd::tests {
 
 class MeasurementsAccessorTestStrategy : public DummyStrategy
 {
@@ -114,13 +110,13 @@
 
 BOOST_AUTO_TEST_CASE(GetParent)
 {
-  Entry& entryRoot = measurements.get("/");
+  auto& entryRoot = measurements.get("/");
   BOOST_CHECK(accessor1->getParent(entryRoot) == nullptr);
   BOOST_CHECK(accessor2->getParent(entryRoot) == nullptr);
 
-  Entry& entryA = measurements.get("/A");
+  auto& entryA = measurements.get("/A");
   BOOST_CHECK(accessor2->getParent(entryA) == nullptr);
-  Entry& entryAD = measurements.get("/A/D");
+  auto& entryAD = measurements.get("/A/D");
   BOOST_CHECK(accessor2->getParent(entryAD) != nullptr);
   // whether accessor1 and accessor3 can getParent(entryA) and getParent(entryAD) is undefined,
   // because they shouldn't have obtained those entries in the first place
@@ -176,6 +172,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestMeasurementsAccessor
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace measurements
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/table/measurements.t.cpp b/tests/daemon/table/measurements.t.cpp
index 23034a3..9ba03d8 100644
--- a/tests/daemon/table/measurements.t.cpp
+++ b/tests/daemon/table/measurements.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -30,11 +30,9 @@
 #include "tests/test-common.hpp"
 #include "tests/daemon/global-io-fixture.hpp"
 
-namespace nfd {
-namespace measurements {
-namespace tests {
+namespace nfd::tests {
 
-using namespace nfd::tests;
+using namespace nfd::measurements;
 
 BOOST_AUTO_TEST_SUITE(Table)
 
@@ -260,6 +258,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestMeasurements
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace measurements
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/table/name-tree.t.cpp b/tests/daemon/table/name-tree.t.cpp
index 6c410aa..8a7665e 100644
--- a/tests/daemon/table/name-tree.t.cpp
+++ b/tests/daemon/table/name-tree.t.cpp
@@ -30,11 +30,9 @@
 
 #include <unordered_set>
 
-namespace nfd {
-namespace name_tree {
-namespace tests {
+namespace nfd::tests {
 
-using namespace nfd::tests;
+using namespace nfd::name_tree;
 
 BOOST_AUTO_TEST_SUITE(Table)
 BOOST_FIXTURE_TEST_SUITE(TestNameTree, GlobalIoFixture)
@@ -764,6 +762,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestNameTree
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace name_tree
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/table/network-region-table.t.cpp b/tests/daemon/table/network-region-table.t.cpp
index 431e3d3..e3c568f 100644
--- a/tests/daemon/table/network-region-table.t.cpp
+++ b/tests/daemon/table/network-region-table.t.cpp
@@ -28,8 +28,7 @@
 #include "tests/test-common.hpp"
 #include "tests/daemon/global-io-fixture.hpp"
 
-namespace nfd {
-namespace tests {
+namespace nfd::tests {
 
 BOOST_AUTO_TEST_SUITE(Table)
 BOOST_FIXTURE_TEST_SUITE(TestNetworkRegionTable, GlobalIoFixture)
@@ -59,5 +58,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestNetworkRegionTable
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/table/pit-entry.t.cpp b/tests/daemon/table/pit-entry.t.cpp
index 6f97a1c..45076e3 100644
--- a/tests/daemon/table/pit-entry.t.cpp
+++ b/tests/daemon/table/pit-entry.t.cpp
@@ -33,11 +33,9 @@
 
 namespace bdata = boost::unit_test::data;
 
-namespace nfd {
-namespace pit {
-namespace tests {
+namespace nfd::tests {
 
-using namespace nfd::tests;
+using namespace nfd::pit;
 
 BOOST_AUTO_TEST_SUITE(Table)
 BOOST_FIXTURE_TEST_SUITE(TestPitEntry, GlobalIoFixture)
@@ -239,6 +237,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestPitEntry
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace pit
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/table/pit.t.cpp b/tests/daemon/table/pit.t.cpp
index defa768..b52ac0e 100644
--- a/tests/daemon/table/pit.t.cpp
+++ b/tests/daemon/table/pit.t.cpp
@@ -27,13 +27,10 @@
 
 #include "tests/test-common.hpp"
 #include "tests/daemon/global-io-fixture.hpp"
-#include "tests/daemon/face/dummy-face.hpp"
 
-namespace nfd {
-namespace pit {
-namespace tests {
+namespace nfd::tests {
 
-using namespace nfd::tests;
+using namespace nfd::pit;
 
 BOOST_AUTO_TEST_SUITE(Table)
 BOOST_FIXTURE_TEST_SUITE(TestPit, GlobalIoFixture)
@@ -344,6 +341,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestPit
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace pit
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/table/strategy-choice.t.cpp b/tests/daemon/table/strategy-choice.t.cpp
index ff6b754..574317d 100644
--- a/tests/daemon/table/strategy-choice.t.cpp
+++ b/tests/daemon/table/strategy-choice.t.cpp
@@ -29,8 +29,7 @@
 #include "tests/daemon/global-io-fixture.hpp"
 #include "tests/daemon/fw/dummy-strategy.hpp"
 
-namespace nfd {
-namespace tests {
+namespace nfd::tests {
 
 class StrategyChoiceFixture : public GlobalIoFixture
 {
@@ -335,5 +334,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestStrategyChoice
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace nfd
+} // namespace nfd::tests
diff --git a/tests/daemon/table/strategy-info-host.t.cpp b/tests/daemon/table/strategy-info-host.t.cpp
index e4323e4..87c36c8 100644
--- a/tests/daemon/table/strategy-info-host.t.cpp
+++ b/tests/daemon/table/strategy-info-host.t.cpp
@@ -28,8 +28,7 @@
 #include "tests/test-common.hpp"
 #include "tests/daemon/global-io-fixture.hpp"
 
-namespace nfd {
-namespace tests {
+namespace nfd::tests {
 
 using fw::StrategyInfo;
 
@@ -131,5 +130,4 @@
 BOOST_AUTO_TEST_SUITE_END() // TestStrategyInfoHost
 BOOST_AUTO_TEST_SUITE_END() // Table
 
-} // namespace tests
-} // namespace nfd
+} // namespace nfd::tests