tests: namespace cleanup
Change-Id: I6b9ee82a4cb3b97c82ea111495ec07efddc8d825
diff --git a/tests/route/test-fib.cpp b/tests/route/test-fib.cpp
index d90d125..d9b4354 100644
--- a/tests/route/test-fib.cpp
+++ b/tests/route/test-fib.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, The University of Memphis,
+ * Copyright (c) 2014-2024, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -28,8 +28,7 @@
#include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
#include <ndn-cxx/util/dummy-client-face.hpp>
-namespace nlsr {
-namespace test {
+namespace nlsr::tests {
static const ndn::Name router1Name = "/ndn/router1";
static const ndn::Name router2Name = "/ndn/router2";
@@ -112,7 +111,7 @@
ndn::nfd::ControlParameters extractedParameters;
ndn::Name::Component verb;
- std::vector<ndn::Interest>::iterator it = interests.begin();
+ auto it = interests.begin();
extractRibCommandParameters(*it, verb, extractedParameters);
@@ -151,7 +150,7 @@
ndn::nfd::ControlParameters extractedParameters;
ndn::Name::Component verb;
- std::vector<ndn::Interest>::iterator it = interests.begin();
+ auto it = interests.begin();
extractRibCommandParameters(*it, verb, extractedParameters);
@@ -192,7 +191,7 @@
ndn::nfd::ControlParameters extractedParameters;
ndn::Name::Component verb;
- std::vector<ndn::Interest>::iterator it = interests.begin();
+ auto it = interests.begin();
extractRibCommandParameters(*it, verb, extractedParameters);
@@ -227,7 +226,7 @@
ndn::nfd::ControlParameters extractedParameters;
ndn::Name::Component verb;
- std::vector<ndn::Interest>::iterator it = interests.begin();
+ auto it = interests.begin();
extractRibCommandParameters(*it, verb, extractedParameters);
@@ -279,7 +278,7 @@
ndn::nfd::ControlParameters extractedParameters;
ndn::Name::Component verb;
- std::vector<ndn::Interest>::iterator it = interests.begin();
+ auto it = interests.begin();
extractRibCommandParameters(*it, verb, extractedParameters);
@@ -388,5 +387,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::tests
diff --git a/tests/route/test-hyperbolic-calculator.cpp b/tests/route/test-hyperbolic-calculator.cpp
index d2df482..5f22a53 100644
--- a/tests/route/test-hyperbolic-calculator.cpp
+++ b/tests/route/test-hyperbolic-calculator.cpp
@@ -30,11 +30,9 @@
#include "tests/io-key-chain-fixture.hpp"
#include "tests/test-common.hpp"
-namespace nlsr {
-namespace test {
+namespace nlsr::tests {
-using ndn::time::system_clock;
-
+constexpr time::system_clock::time_point MAX_TIME = time::system_clock::time_point::max();
static const ndn::Name ROUTER_A_NAME = "/ndn/router/a";
static const ndn::Name ROUTER_B_NAME = "/ndn/router/b";
static const ndn::Name ROUTER_C_NAME = "/ndn/router/c";
@@ -42,8 +40,6 @@
static const ndn::FaceUri ROUTER_B_FACE("udp4://10.0.0.2:6363");
static const ndn::FaceUri ROUTER_C_FACE("udp4://10.0.0.3:6363");
-constexpr system_clock::time_point MAX_TIME = system_clock::time_point::max();
-
class HyperbolicCalculatorFixture : public IoKeyChainFixture
{
public:
@@ -185,5 +181,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::tests
diff --git a/tests/route/test-link-state-calculator.cpp b/tests/route/test-link-state-calculator.cpp
index 877f204..de1327f 100644
--- a/tests/route/test-link-state-calculator.cpp
+++ b/tests/route/test-link-state-calculator.cpp
@@ -31,10 +31,9 @@
#include "tests/io-key-chain-fixture.hpp"
#include "tests/test-common.hpp"
-namespace nlsr {
-namespace test {
+namespace nlsr::tests {
-constexpr ndn::time::system_clock::time_point MAX_TIME = ndn::time::system_clock::time_point::max();
+constexpr time::system_clock::time_point MAX_TIME = time::system_clock::time_point::max();
static const ndn::Name ROUTER_A_NAME = "/ndn/site/%C1.Router/this-router";
static const ndn::Name ROUTER_B_NAME = "/ndn/site/%C1.Router/b";
static const ndn::Name ROUTER_C_NAME = "/ndn/site/%C1.Router/c";
@@ -300,5 +299,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::tests
diff --git a/tests/route/test-map.cpp b/tests/route/test-map.cpp
index 424c551..aabf055 100644
--- a/tests/route/test-map.cpp
+++ b/tests/route/test-map.cpp
@@ -18,12 +18,13 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*
* \author Ashlesh Gawande <agawande@memphis.edu>
- **/
+ */
#include "route/map.hpp"
+
#include "tests/boost-test.hpp"
-namespace nlsr::test {
+namespace nlsr::tests {
BOOST_AUTO_TEST_SUITE(TestMap)
@@ -57,4 +58,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace nlsr::test
+} // namespace nlsr::tests
diff --git a/tests/route/test-name-prefix-table-entry.cpp b/tests/route/test-name-prefix-table-entry.cpp
index 949c380..69f3579 100644
--- a/tests/route/test-name-prefix-table-entry.cpp
+++ b/tests/route/test-name-prefix-table-entry.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2019, The University of Memphis,
+/*
+ * Copyright (c) 2014-2024, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -18,13 +18,13 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*
* \author Ashlesh Gawande <agawande@memphis.edu>
- **/
+ */
#include "route/name-prefix-table-entry.hpp"
+
#include "tests/boost-test.hpp"
-namespace nlsr {
-namespace test {
+namespace nlsr::tests {
BOOST_AUTO_TEST_SUITE(TestNpte)
@@ -39,18 +39,13 @@
{
NamePrefixTableEntry npte1("/ndn/memphis/rtr1");
RoutingTablePoolEntry rtpe1("/ndn/memphis/rtr2", 0);
- std::shared_ptr<RoutingTablePoolEntry> rtpePtr
- = std::make_shared<RoutingTablePoolEntry>(rtpe1);
+ auto rtpePtr = std::make_shared<RoutingTablePoolEntry>(rtpe1);
BOOST_CHECK_EQUAL(npte1.m_rteList.size(), 0);
npte1.addRoutingTableEntry(rtpePtr);
BOOST_CHECK_EQUAL(npte1.m_rteList.size(), 1);
- std::list<std::shared_ptr<RoutingTablePoolEntry>>::iterator itr =
- std::find(npte1.m_rteList.begin(),
- npte1.m_rteList.end(),
- rtpePtr);
-
+ auto itr = std::find(npte1.m_rteList.begin(), npte1.m_rteList.end(), rtpePtr);
BOOST_CHECK_EQUAL(rtpePtr, *itr);
}
@@ -58,8 +53,7 @@
{
NamePrefixTableEntry npte1("/ndn/memphis/rtr1");
RoutingTablePoolEntry rtpe1("/ndn/memphis/rtr2", 0);
- std::shared_ptr<RoutingTablePoolEntry> rtpePtr
- = std::make_shared<RoutingTablePoolEntry>(rtpe1);
+ auto rtpePtr = std::make_shared<RoutingTablePoolEntry>(rtpe1);
npte1.addRoutingTableEntry(rtpePtr);
npte1.removeRoutingTableEntry(rtpePtr);
@@ -91,5 +85,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::tests
diff --git a/tests/route/test-name-prefix-table.cpp b/tests/route/test-name-prefix-table.cpp
index adeaa6d..66c1826 100644
--- a/tests/route/test-name-prefix-table.cpp
+++ b/tests/route/test-name-prefix-table.cpp
@@ -27,8 +27,7 @@
#include "tests/io-key-chain-fixture.hpp"
#include "tests/test-common.hpp"
-namespace nlsr {
-namespace test {
+namespace nlsr::tests {
class NamePrefixTableFixture : public IoKeyChainFixture
{
@@ -76,54 +75,39 @@
// This router's Adjacency LSA
conf.getAdjacencyList().insert(bupt);
- AdjLsa thisRouterAdjLsa(thisRouter.getName(), 1,
- ndn::time::system_clock::now() + 3600_s,
- conf.getAdjacencyList());
-
+ AdjLsa thisRouterAdjLsa(thisRouter.getName(), 1, time::system_clock::now() + 3600_s, conf.getAdjacencyList());
lsdb.installLsa(std::make_shared<AdjLsa>(thisRouterAdjLsa));
// BUPT Adjacency LSA
AdjacencyList buptAdjacencies;
buptAdjacencies.insert(thisRouter);
- AdjLsa buptAdjLsa(buptRouterName, 1,
- ndn::time::system_clock::now() + ndn::time::seconds(5),
- buptAdjacencies);
-
+ AdjLsa buptAdjLsa(buptRouterName, 1, time::system_clock::now() + 5_s, buptAdjacencies);
lsdb.installLsa(std::make_shared<AdjLsa>(buptAdjLsa));
// BUPT Name LSA
ndn::Name buptAdvertisedName("/ndn/cn/edu/bupt");
-
NamePrefixList buptNames{buptAdvertisedName};
-
- NameLsa buptNameLsa(buptRouterName, 1, ndn::time::system_clock::now() + ndn::time::seconds(5),
- buptNames);
-
+ NameLsa buptNameLsa(buptRouterName, 1, time::system_clock::now() + 5_s, buptNames);
lsdb.installLsa(std::make_shared<NameLsa>(buptNameLsa));
// Advance clocks to expire LSAs
- this->advanceClocks(ndn::time::seconds(15));
+ this->advanceClocks(15_s);
// LSA expirations should cause NPT entries to be completely removed
- NamePrefixTable::const_iterator it = npt.begin();
- BOOST_REQUIRE(it == npt.end());
+ auto it = npt.begin();
+ BOOST_CHECK(it == npt.end());
// Install new name LSA
- NameLsa buptNewNameLsa(buptRouterName, 12,
- ndn::time::system_clock::now() + ndn::time::seconds(3600),
- buptNames);
-
+ NameLsa buptNewNameLsa(buptRouterName, 12, time::system_clock::now() + 3600_s, buptNames);
lsdb.installLsa(std::make_shared<NameLsa>(buptNewNameLsa));
- this->advanceClocks(ndn::time::seconds(1));
+ this->advanceClocks(1_s);
// Install new adjacency LSA
- AdjLsa buptNewAdjLsa(buptRouterName, 12,
- ndn::time::system_clock::now() + ndn::time::seconds(3600),
- buptAdjacencies);
+ AdjLsa buptNewAdjLsa(buptRouterName, 12, time::system_clock::now() + 3600_s, buptAdjacencies);
lsdb.installLsa(std::make_shared<AdjLsa>(buptNewAdjLsa));
- this->advanceClocks(ndn::time::seconds(1));
+ this->advanceClocks(1_s);
// Each NPT entry should have a destination router
it = npt.begin();
@@ -168,18 +152,14 @@
npt.addEntry("/ndn/memphis/rtr2", "/ndn/memphis/rtr1");
- NamePrefixTable::NptEntryList::iterator nItr =
- std::find_if(npt.m_table.begin(),
- npt.m_table.end(),
- [&] (const std::shared_ptr<NamePrefixTableEntry>& entry) {
- return entry->getNamePrefix() == npte1.getNamePrefix();
- });
+ auto nItr = std::find_if(npt.m_table.begin(),
+ npt.m_table.end(),
+ [&] (const auto& entry) {
+ return entry->getNamePrefix() == npte1.getNamePrefix();
+ });
std::list<std::shared_ptr<RoutingTablePoolEntry>> rtpeList = (*nItr)->getRteList();
- std::list<std::shared_ptr<RoutingTablePoolEntry>>::iterator rItr =
- std::find(rtpeList.begin(),
- rtpeList.end(),
- rtpePtr);
+ auto rItr = std::find(rtpeList.begin(), rtpeList.end(), rtpePtr);
BOOST_CHECK_EQUAL(**rItr, *rtpePtr);
}
@@ -195,12 +175,11 @@
npt.removeEntry("/ndn/memphis/rtr2", "/ndn/memphis/rtr1");
- NamePrefixTable::NptEntryList::iterator nItr =
- std::find_if(npt.m_table.begin(),
- npt.m_table.end(),
- [&] (const std::shared_ptr<NamePrefixTableEntry>& entry) {
- return entry->getNamePrefix() == npte1.getNamePrefix();
- });
+ auto nItr = std::find_if(npt.m_table.begin(),
+ npt.m_table.end(),
+ [&] (const auto& entry) {
+ return entry->getNamePrefix() == npte1.getNamePrefix();
+ });
std::list<std::shared_ptr<RoutingTablePoolEntry>> rtpeList = (*nItr)->getRteList();
@@ -215,12 +194,11 @@
npt.addEntry("/ndn/memphis/rtr2", "/ndn/memphis/rtr1");
- NamePrefixTable::NptEntryList::iterator nItr =
- std::find_if(npt.m_table.begin(),
- npt.m_table.end(),
- [&] (const std::shared_ptr<NamePrefixTableEntry>& entry) {
- return entry->getNamePrefix() == npte1.getNamePrefix();
- });
+ auto nItr = std::find_if(npt.m_table.begin(),
+ npt.m_table.end(),
+ [&] (const auto& entry) {
+ return entry->getNamePrefix() == npte1.getNamePrefix();
+ });
std::list<std::shared_ptr<RoutingTablePoolEntry>> rtpeList = (*nItr)->getRteList();
@@ -247,12 +225,11 @@
npt.addEntry(npte2.getNamePrefix(), rte1.getDestination());
npt.removeEntry(npte2.getNamePrefix(), rte1.getDestination());
- NamePrefixTable::NptEntryList::iterator nItr =
- std::find_if(npt.m_table.begin(),
- npt.m_table.end(),
- [&] (const std::shared_ptr<NamePrefixTableEntry>& entry) {
- return entry->getNamePrefix() == npte1.getNamePrefix();
- });
+ auto nItr = std::find_if(npt.m_table.begin(),
+ npt.m_table.end(),
+ [&] (const auto& entry) {
+ return entry->getNamePrefix() == npte1.getNamePrefix();
+ });
std::list<std::shared_ptr<RoutingTablePoolEntry>> rtpeList = (*nItr)->getRteList();
@@ -314,7 +291,7 @@
BOOST_FIXTURE_TEST_CASE(UpdateFromLsdb, NamePrefixTableFixture)
{
- auto testTimePoint = ndn::time::system_clock::now();
+ auto testTimePoint = time::system_clock::now();
NamePrefixList npl1;
ndn::Name n1("name1");
ndn::Name n2("name2");
@@ -373,5 +350,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::tests
diff --git a/tests/route/test-nexthop-list.cpp b/tests/route/test-nexthop-list.cpp
index 5801104..9947df5 100644
--- a/tests/route/test-nexthop-list.cpp
+++ b/tests/route/test-nexthop-list.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, The University of Memphis,
+ * Copyright (c) 2014-2024, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -22,10 +22,10 @@
#include "route/nexthop-list.hpp"
#include "route/nexthop.hpp"
#include "route/fib.hpp"
+
#include "tests/boost-test.hpp"
-namespace nlsr {
-namespace test {
+namespace nlsr::tests {
BOOST_AUTO_TEST_SUITE(TestNhl)
@@ -99,7 +99,7 @@
list.addNextHop(hopA);
list.addNextHop(hopZ);
- NexthopList::iterator it = list.begin();
+ auto it = list.begin();
BOOST_CHECK_EQUAL(it->getConnectingFaceUri(), hopA.getConnectingFaceUri());
list.clear();
@@ -212,5 +212,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::tests
diff --git a/tests/route/test-nexthop.cpp b/tests/route/test-nexthop.cpp
index 9d80c1f..89722f8 100644
--- a/tests/route/test-nexthop.cpp
+++ b/tests/route/test-nexthop.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, The University of Memphis,
+ * Copyright (c) 2014-2024, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -19,10 +19,10 @@
*/
#include "route/nexthop.hpp"
+
#include "tests/boost-test.hpp"
-namespace nlsr {
-namespace test {
+namespace nlsr::tests {
BOOST_AUTO_TEST_SUITE(TestNexthop)
@@ -32,13 +32,13 @@
static double
getHyperbolicAdjustedDecimal(unsigned int i)
{
- return static_cast<double>(i)/(10*NextHop::HYPERBOLIC_COST_ADJUSTMENT_FACTOR);
+ return static_cast<double>(i)/(10 * NextHop::HYPERBOLIC_COST_ADJUSTMENT_FACTOR);
}
static uint64_t
applyHyperbolicFactorAndRound(double d)
{
- return round(NextHop::HYPERBOLIC_COST_ADJUSTMENT_FACTOR*d);
+ return round(NextHop::HYPERBOLIC_COST_ADJUSTMENT_FACTOR * d);
}
BOOST_AUTO_TEST_CASE(LinkStateSetAndGet)
@@ -158,5 +158,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::tests
diff --git a/tests/route/test-routing-table-entry.cpp b/tests/route/test-routing-table-entry.cpp
index 9d685ae..27da605 100644
--- a/tests/route/test-routing-table-entry.cpp
+++ b/tests/route/test-routing-table-entry.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, The University of Memphis,
+ * Copyright (c) 2014-2024, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -19,10 +19,10 @@
*/
#include "route/routing-table-entry.hpp"
+
#include "tests/boost-test.hpp"
-namespace nlsr {
-namespace test {
+namespace nlsr::tests {
BOOST_AUTO_TEST_SUITE(TestRoutingTableEntry)
@@ -155,5 +155,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::tests
diff --git a/tests/route/test-routing-table-pool-entry.cpp b/tests/route/test-routing-table-pool-entry.cpp
index 9b2be00..08c2062 100644
--- a/tests/route/test-routing-table-pool-entry.cpp
+++ b/tests/route/test-routing-table-pool-entry.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, The University of Memphis,
+ * Copyright (c) 2014-2024, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -18,7 +18,7 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*
* \author Nicholas Gordon <nmgordon@memphis.edu>
- **/
+ */
#include "route/routing-table-pool-entry.hpp"
#include "route/nexthop.hpp"
@@ -26,8 +26,7 @@
#include "tests/boost-test.hpp"
-namespace nlsr {
-namespace test {
+namespace nlsr::tests {
BOOST_AUTO_TEST_SUITE(TestRoutingTablePoolEntry)
@@ -99,5 +98,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::tests
diff --git a/tests/route/test-routing-table.cpp b/tests/route/test-routing-table.cpp
index de91bea..540a0cb 100644
--- a/tests/route/test-routing-table.cpp
+++ b/tests/route/test-routing-table.cpp
@@ -26,8 +26,7 @@
#include "tests/io-key-chain-fixture.hpp"
#include "tests/test-common.hpp"
-namespace nlsr {
-namespace test {
+namespace nlsr::tests {
class RoutingTableFixture : public IoKeyChainFixture
{
@@ -122,7 +121,7 @@
BOOST_FIXTURE_TEST_CASE(UpdateFromLsdb, RoutingTableFixture)
{
- auto testTimePoint = ndn::time::system_clock::now() + 3600_s;
+ auto testTimePoint = time::system_clock::now() + 3600_s;
ndn::Name router2("/router2");
AdjLsa adjLsa(router2, 12, testTimePoint, conf.getAdjacencyList());
std::shared_ptr<Lsa> lsaPtr = std::make_shared<AdjLsa>(adjLsa);
@@ -199,5 +198,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::tests