tests: namespace cleanup
Change-Id: I6b9ee82a4cb3b97c82ea111495ec07efddc8d825
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