build: migrate to C++17
Change-Id: Ic9f09efd20b608bfcb713fd319834b2666cf6242
diff --git a/tests/clock-fixture.hpp b/tests/clock-fixture.hpp
index 401f6b4..62e6224 100644
--- a/tests/clock-fixture.hpp
+++ b/tests/clock-fixture.hpp
@@ -28,8 +28,7 @@
#include <ndn-cxx/util/time-unit-test-clock.hpp>
-namespace nlsr {
-namespace test {
+namespace nlsr::test {
namespace time = ndn::time;
@@ -85,7 +84,6 @@
std::shared_ptr<time::UnitTestSystemClock> m_systemClock;
};
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::test
#endif // NLSR_TESTS_CLOCK_FIXTURE_HPP
diff --git a/tests/io-fixture.hpp b/tests/io-fixture.hpp
index b30663a..782f7df 100644
--- a/tests/io-fixture.hpp
+++ b/tests/io-fixture.hpp
@@ -30,8 +30,7 @@
#include <boost/asio/io_service.hpp>
-namespace nlsr {
-namespace test {
+namespace nlsr::test {
class IoFixture : public ClockFixture
{
@@ -53,7 +52,6 @@
boost::asio::io_service m_io;
};
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::test
#endif // NLSR_TESTS_IO_FIXTURE_HPP
diff --git a/tests/io-key-chain-fixture.hpp b/tests/io-key-chain-fixture.hpp
index 199bd28..89ab07b 100644
--- a/tests/io-key-chain-fixture.hpp
+++ b/tests/io-key-chain-fixture.hpp
@@ -25,14 +25,12 @@
#include "tests/key-chain-fixture.hpp"
#include "tests/io-fixture.hpp"
-namespace nlsr {
-namespace test {
+namespace nlsr::test {
class IoKeyChainFixture : public IoFixture, public KeyChainFixture
{
};
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::test
#endif // NLSR_TESTS_IO_KEY_CHAIN_FIXTURE_HPP
diff --git a/tests/key-chain-fixture.hpp b/tests/key-chain-fixture.hpp
index 3684cad..f4303c6 100644
--- a/tests/key-chain-fixture.hpp
+++ b/tests/key-chain-fixture.hpp
@@ -29,8 +29,7 @@
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/security/signing-helpers.hpp>
-namespace nlsr {
-namespace test {
+namespace nlsr::test {
/**
* @brief A fixture providing an in-memory KeyChain.
@@ -96,7 +95,6 @@
std::vector<std::string> m_certFiles;
};
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::test
#endif // NLSR_TESTS_KEY_CHAIN_FIXTURE_HPP
diff --git a/tests/publisher/test-dataset-interest-handler.cpp b/tests/publisher/test-dataset-interest-handler.cpp
index 2e71585..c637856 100644
--- a/tests/publisher/test-dataset-interest-handler.cpp
+++ b/tests/publisher/test-dataset-interest-handler.cpp
@@ -55,19 +55,19 @@
// Request adjacency LSAs
face.receive(ndn::Interest("/localhost/nlsr/lsdb/adjacencies").setCanBePrefix(true));
- processDatasetInterest([] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::AdjacencyLsa; });
+ processDatasetInterest([] (const ndn::Block& block) { return block.type() == nlsr::tlv::AdjacencyLsa; });
// Request coordinate LSAs
face.receive(ndn::Interest("/localhost/nlsr/lsdb/coordinates").setCanBePrefix(true));
- processDatasetInterest([] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::CoordinateLsa; });
+ processDatasetInterest([] (const ndn::Block& block) { return block.type() == nlsr::tlv::CoordinateLsa; });
// Request Name LSAs
face.receive(ndn::Interest("/localhost/nlsr/lsdb/names").setCanBePrefix(true));
- processDatasetInterest([] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::NameLsa; });
+ processDatasetInterest([] (const ndn::Block& block) { return block.type() == nlsr::tlv::NameLsa; });
// Request Routing Table
face.receive(ndn::Interest("/localhost/nlsr/routing-table").setCanBePrefix(true));
- processDatasetInterest([] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::RoutingTable; });
+ processDatasetInterest([] (const ndn::Block& block) { return block.type() == nlsr::tlv::RoutingTable; });
}
BOOST_AUTO_TEST_CASE(RouterName)
@@ -101,19 +101,19 @@
// Request adjacency LSAs
face.receive(ndn::Interest(ndn::Name(routerName).append("lsdb").append("adjacencies")).setCanBePrefix(true));
- processDatasetInterest([] (const auto& block) { return block.type() == ndn::tlv::nlsr::AdjacencyLsa; });
+ processDatasetInterest([] (const auto& block) { return block.type() == nlsr::tlv::AdjacencyLsa; });
// Request coordinate LSAs
face.receive(ndn::Interest(ndn::Name(routerName).append("lsdb").append("coordinates")).setCanBePrefix(true));
- processDatasetInterest([] (const auto& block) { return block.type() == ndn::tlv::nlsr::CoordinateLsa; });
+ processDatasetInterest([] (const auto& block) { return block.type() == nlsr::tlv::CoordinateLsa; });
// Request Name LSAs
face.receive(ndn::Interest(ndn::Name(routerName).append("lsdb").append("names")).setCanBePrefix(true));
- processDatasetInterest([] (const auto& block) { return block.type() == ndn::tlv::nlsr::NameLsa; });
+ processDatasetInterest([] (const auto& block) { return block.type() == nlsr::tlv::NameLsa; });
// Request Routing Table
face.receive(ndn::Interest(ndn::Name(routerName).append("routing-table")).setCanBePrefix(true));
- processDatasetInterest([] (const auto& block) { return block.type() == ndn::tlv::nlsr::RoutingTable; });
+ processDatasetInterest([] (const auto& block) { return block.type() == nlsr::tlv::RoutingTable; });
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/route/test-routing-table-entry.cpp b/tests/route/test-routing-table-entry.cpp
index ef470e1..f30e17e 100644
--- a/tests/route/test-routing-table-entry.cpp
+++ b/tests/route/test-routing-table-entry.cpp
@@ -26,15 +26,14 @@
BOOST_AUTO_TEST_SUITE(TestRoutingTableEntry)
-BOOST_AUTO_TEST_CASE(RoutingTableEntryDestination)
+BOOST_AUTO_TEST_CASE(Destination)
{
RoutingTableEntry rte1("router1");
BOOST_CHECK_EQUAL(rte1.getDestination(), "router1");
}
-const uint8_t RoutingTableEntryWithNexthopsData[] =
-{
+const uint8_t RoutingTableEntryWithNexthopsData[] = {
// Header
0x91, 0x35,
// Destination Name
@@ -47,15 +46,14 @@
0x66, 0x66, 0x66, 0x66
};
-const uint8_t RoutingTableEntryWithoutNexthopsData[] =
-{
+const uint8_t RoutingTableEntryWithoutNexthopsData[] = {
// Header
0x91, 0x09,
// Destination Name
0x07, 0x07, 0x08, 0x05, 0x64, 0x65, 0x73, 0x74, 0x31
};
-BOOST_AUTO_TEST_CASE(RoutingTableEntryEncodeWithNexthops)
+BOOST_AUTO_TEST_CASE(EncodeWithNexthops)
{
RoutingTableEntry rte(ndn::Name("dest1"));
@@ -73,7 +71,7 @@
boost::test_tools::per_element());
}
-BOOST_AUTO_TEST_CASE(RoutingTableEntryDecodeWithNexthops)
+BOOST_AUTO_TEST_CASE(DecodeWithNexthops)
{
RoutingTableEntry rte(ndn::Block{RoutingTableEntryWithNexthopsData});
BOOST_CHECK_EQUAL(rte.getDestination(), "dest1");
@@ -88,21 +86,21 @@
BOOST_CHECK_EQUAL(it->getRouteCost(), 1.65);
}
-BOOST_AUTO_TEST_CASE(RoutingTableEntryEncodeWithoutNexthops)
+BOOST_AUTO_TEST_CASE(EncodeWithoutNexthops)
{
RoutingTableEntry rte(ndn::Name("dest1"));
BOOST_TEST(rte.wireEncode() == RoutingTableEntryWithoutNexthopsData,
boost::test_tools::per_element());
}
-BOOST_AUTO_TEST_CASE(RoutingTableEntryDecodeWithoutNexthops)
+BOOST_AUTO_TEST_CASE(DecodeWithoutNexthops)
{
RoutingTableEntry rte(ndn::Block{RoutingTableEntryWithoutNexthopsData});
BOOST_CHECK_EQUAL(rte.getDestination(), "dest1");
BOOST_CHECK_EQUAL(rte.getNexthopList().size(), 0);
}
-BOOST_AUTO_TEST_CASE(RoutingTableEntryClear)
+BOOST_AUTO_TEST_CASE(Clear)
{
RoutingTableEntry rte(ndn::Name("dest1"));
@@ -131,7 +129,7 @@
BOOST_CHECK_EQUAL(it->getRouteCost(), 99);
}
-BOOST_AUTO_TEST_CASE(RoutingTableEntryOutputStream)
+BOOST_AUTO_TEST_CASE(OutputStream)
{
RoutingTableEntry rte(ndn::Name("dest1"));
diff --git a/tests/route/test-routing-table.cpp b/tests/route/test-routing-table.cpp
index 15ad958..6bbe475 100644
--- a/tests/route/test-routing-table.cpp
+++ b/tests/route/test-routing-table.cpp
@@ -45,7 +45,7 @@
BOOST_AUTO_TEST_SUITE(TestRoutingTable)
-BOOST_FIXTURE_TEST_CASE(RoutingTableAddNextHop, RoutingTableFixture)
+BOOST_FIXTURE_TEST_CASE(AddNextHop, RoutingTableFixture)
{
NextHop nh1;
const std::string DEST_ROUTER = "destRouter";
@@ -54,8 +54,7 @@
BOOST_CHECK_EQUAL(rt.findRoutingTableEntry(DEST_ROUTER)->getDestination(), DEST_ROUTER);
}
-const uint8_t RoutingTableData1[] =
-{
+const uint8_t RoutingTableData1[] = {
// Header
0x90, 0x20,
// Routing table entry
@@ -67,39 +66,30 @@
0x66, 0x66, 0x66, 0x66, 0x66
};
-const uint8_t RoutingTableData2[] =
-{
+const uint8_t RoutingTableData2[] = {
// Header
0x90, 0x00
};
-BOOST_FIXTURE_TEST_CASE(RoutingTableEncode1, RoutingTableFixture)
+BOOST_FIXTURE_TEST_CASE(Encode, RoutingTableFixture)
{
NextHop nexthops;
nexthops.setConnectingFaceUri("nexthop");
nexthops.setRouteCost(1.65);
rt.addNextHop("dest1", nexthops);
-
- auto wire = rt.wireEncode();
- BOOST_REQUIRE_EQUAL_COLLECTIONS(RoutingTableData1,
- RoutingTableData1 + sizeof(RoutingTableData1),
- wire.begin(), wire.end());
+ BOOST_TEST(rt.wireEncode() == RoutingTableData1, boost::test_tools::per_element());
}
-BOOST_FIXTURE_TEST_CASE(RoutingTableEncode2, RoutingTableFixture)
+BOOST_FIXTURE_TEST_CASE(EncodeEmpty, RoutingTableFixture)
{
- auto wire = rt.wireEncode();
- BOOST_REQUIRE_EQUAL_COLLECTIONS(RoutingTableData2,
- RoutingTableData2 + sizeof(RoutingTableData2),
- wire.begin(), wire.end());
+ BOOST_TEST(rt.wireEncode() == RoutingTableData2, boost::test_tools::per_element());
}
-BOOST_FIXTURE_TEST_CASE(RoutingTableDecode1, RoutingTableFixture)
+BOOST_FIXTURE_TEST_CASE(Decode, RoutingTableFixture)
{
RoutingTableStatus rtStatus(ndn::Block{RoutingTableData1});
auto it1 = rtStatus.m_rTable.begin();
-
ndn::Name des1 = it1->getDestination();
BOOST_CHECK_EQUAL(des1, "dest1");
@@ -110,7 +100,7 @@
BOOST_CHECK_EQUAL(rtStatus.m_rTable.size(), 1);
}
-BOOST_FIXTURE_TEST_CASE(RoutingTableOutputStream, RoutingTableFixture)
+BOOST_FIXTURE_TEST_CASE(OutputStream, RoutingTableFixture)
{
NextHop nexthops;
nexthops.setConnectingFaceUri("nexthop");
diff --git a/tests/security/test-certificate-store.cpp b/tests/security/test-certificate-store.cpp
index 0db13a8..6c8a4f6 100644
--- a/tests/security/test-certificate-store.cpp
+++ b/tests/security/test-certificate-store.cpp
@@ -119,7 +119,7 @@
const boost::filesystem::path ROOT_CERT_PATH;
};
-BOOST_FIXTURE_TEST_SUITE(TestSecurityCertificateStore, CertificateStoreFixture)
+BOOST_FIXTURE_TEST_SUITE(TestCertificateStore, CertificateStoreFixture)
BOOST_AUTO_TEST_CASE(Basic)
{
diff --git a/tests/test-adjacency-list.cpp b/tests/test-adjacency-list.cpp
index c1bf482..565052c 100644
--- a/tests/test-adjacency-list.cpp
+++ b/tests/test-adjacency-list.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2020, The University of Memphis,
+/*
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
#include "adjacency-list.hpp"
#include "common.hpp"
@@ -64,7 +64,7 @@
BOOST_CHECK_EQUAL(adjacentList1.getStatusOfNeighbor(n1), Adjacent::STATUS_ACTIVE);
}
-BOOST_AUTO_TEST_CASE(findAdjacentByFaceUri)
+BOOST_AUTO_TEST_CASE(FindAdjacentByFaceUri)
{
ndn::FaceUri faceUri("udp4://10.0.0.1:6363");
Adjacent adj1("/ndn/test/1", faceUri, 10, Adjacent::STATUS_INACTIVE, 0, 0);
diff --git a/tests/test-adjacent.cpp b/tests/test-adjacent.cpp
index 3d61a3a..5406096 100644
--- a/tests/test-adjacent.cpp
+++ b/tests/test-adjacent.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2020, The University of Memphis,
+/*
+ * Copyright (c) 2014-2022, 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 Ashlesh Gawande <agawande@memphis.edu>
- **/
+ */
#include "adjacent.hpp"
#include "tests/boost-test.hpp"
@@ -26,8 +26,6 @@
namespace nlsr {
namespace test {
-using namespace std;
-
BOOST_AUTO_TEST_SUITE(TestAdjacent)
BOOST_AUTO_TEST_CASE(OperatorEquals)
@@ -77,7 +75,7 @@
BOOST_CHECK_EQUAL(adjacent1.getLinkCost(), 11);
}
-BOOST_AUTO_TEST_CASE(compareFaceUri)
+BOOST_AUTO_TEST_CASE(CompareFaceUri)
{
const ndn::Name ADJ_NAME_1 = "name1";
const ndn::Name ADJ_NAME_2 = "name2";
@@ -90,7 +88,7 @@
BOOST_CHECK(adjacent1.compareFaceUri(adjacent2.getFaceUri()));
}
-BOOST_AUTO_TEST_CASE(compareFaceId)
+BOOST_AUTO_TEST_CASE(CompareFaceId)
{
const ndn::Name ADJ_NAME_1 = "name1";
const ndn::Name ADJ_NAME_2 = "name2";
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 5c95a0c..1c8c0e2 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -29,8 +29,7 @@
#include <ndn-cxx/data.hpp>
#include <ndn-cxx/util/dummy-client-face.hpp>
-namespace nlsr {
-namespace test {
+namespace nlsr::test {
/**
* \brief Create a Data with a null (i.e., empty) signature
@@ -78,7 +77,6 @@
}
};
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::test
#endif // NLSR_TESTS_TEST_COMMON_HPP
diff --git a/tests/test-lsa.cpp b/tests/test-lsa.cpp
index 9fb6863..1e89d9f 100644
--- a/tests/test-lsa.cpp
+++ b/tests/test-lsa.cpp
@@ -101,26 +101,22 @@
BOOST_CHECK(nlsa1.getExpirationTimePoint() == nlsa2.getExpirationTimePoint());
auto wire = nlsa1.wireEncode();
- BOOST_CHECK_EQUAL_COLLECTIONS(NAME_LSA1, NAME_LSA1 + sizeof(NAME_LSA1),
- wire.begin(), wire.end());
+ BOOST_TEST(wire == NAME_LSA1, boost::test_tools::per_element());
nlsa1.addName("name3");
wire = nlsa1.wireEncode();
- BOOST_CHECK_EQUAL_COLLECTIONS(NAME_LSA_EXTRA_NAME,
- NAME_LSA_EXTRA_NAME + sizeof(NAME_LSA_EXTRA_NAME),
- wire.begin(), wire.end());
+ BOOST_TEST(wire == NAME_LSA_EXTRA_NAME, boost::test_tools::per_element());
nlsa1.setSeqNo(14);
wire = nlsa1.wireEncode();
- BOOST_CHECK_EQUAL_COLLECTIONS(NAME_LSA_DIFF_SEQ, NAME_LSA_DIFF_SEQ + sizeof(NAME_LSA_DIFF_SEQ),
- wire.begin(), wire.end());
+ BOOST_TEST(wire == NAME_LSA_DIFF_SEQ, boost::test_tools::per_element());
testTimePoint =
ndn::time::fromUnixTimestamp(ndn::time::milliseconds(1585196024993));
nlsa1.setExpirationTimePoint(testTimePoint);
wire = nlsa1.wireEncode();
- BOOST_CHECK_EQUAL_COLLECTIONS(NAME_LSA_DIFF_TS, NAME_LSA_DIFF_TS + sizeof(NAME_LSA_DIFF_TS),
- wire.begin(), wire.end());
+ BOOST_TEST(wire == NAME_LSA_DIFF_TS, boost::test_tools::per_element());
+
// Not testing router name as not sure if that will ever change once set
}
@@ -209,28 +205,22 @@
BOOST_CHECK(alsa1.isEqualContent(alsa3));
auto wire = alsa1.wireEncode();
- BOOST_CHECK_EQUAL_COLLECTIONS(ADJ_LSA1, ADJ_LSA1 + sizeof(ADJ_LSA1),
- wire.begin(), wire.end());
+ BOOST_TEST(wire == ADJ_LSA1, boost::test_tools::per_element());
Adjacent activeAdjacency2("/ndn/edu/adjacency");
activeAdjacency2.setStatus(Adjacent::STATUS_ACTIVE);
alsa1.addAdjacent(activeAdjacency2);
wire = alsa1.wireEncode();
- BOOST_CHECK_EQUAL_COLLECTIONS(ADJ_LSA_EXTRA_NEIGHBOR,
- ADJ_LSA_EXTRA_NEIGHBOR + sizeof(ADJ_LSA_EXTRA_NEIGHBOR),
- wire.begin(), wire.end());
+ BOOST_TEST(wire == ADJ_LSA_EXTRA_NEIGHBOR, boost::test_tools::per_element());
alsa1.setSeqNo(14);
wire = alsa1.wireEncode();
- BOOST_CHECK_EQUAL_COLLECTIONS(ADJ_LSA_DIFF_SEQ, ADJ_LSA_DIFF_SEQ + sizeof(ADJ_LSA_DIFF_SEQ),
- wire.begin(), wire.end());
+ BOOST_TEST(wire == ADJ_LSA_DIFF_SEQ, boost::test_tools::per_element());
- testTimePoint =
- ndn::time::fromUnixTimestamp(ndn::time::milliseconds(1585196024993));
+ testTimePoint = ndn::time::fromUnixTimestamp(ndn::time::milliseconds(1585196024993));
alsa1.setExpirationTimePoint(testTimePoint);
wire = alsa1.wireEncode();
- BOOST_CHECK_EQUAL_COLLECTIONS(ADJ_LSA_DIFF_TS, ADJ_LSA_DIFF_TS + sizeof(ADJ_LSA_DIFF_TS),
- wire.begin(), wire.end());
+ BOOST_TEST(wire == ADJ_LSA_DIFF_TS, boost::test_tools::per_element());
}
const uint8_t COORDINATE_LSA1[] = {
@@ -286,35 +276,25 @@
BOOST_CHECK_EQUAL(clsa1.wireEncode(), clsa2.wireEncode());
auto wire = clsa1.wireEncode();
- BOOST_CHECK_EQUAL_COLLECTIONS(COORDINATE_LSA1, COORDINATE_LSA1 + sizeof(COORDINATE_LSA1),
- wire.begin(), wire.end());
+ BOOST_TEST(wire == COORDINATE_LSA1, boost::test_tools::per_element());
std::vector<double> angles3{40.0};
clsa1.setCorTheta(angles3);
wire = clsa1.wireEncode();
- BOOST_CHECK_EQUAL_COLLECTIONS(COORDINATE_LSA_DIFF_ANGLE,
- COORDINATE_LSA_DIFF_ANGLE + sizeof(COORDINATE_LSA_DIFF_ANGLE),
- wire.begin(), wire.end());
+ BOOST_TEST(wire == COORDINATE_LSA_DIFF_ANGLE, boost::test_tools::per_element());
clsa1.setCorRadius(2.3);
wire = clsa1.wireEncode();
- BOOST_CHECK_EQUAL_COLLECTIONS(COORDINATE_LSA_DIFF_RADIUS,
- COORDINATE_LSA_DIFF_RADIUS + sizeof(COORDINATE_LSA_DIFF_RADIUS),
- wire.begin(), wire.end());
+ BOOST_TEST(wire == COORDINATE_LSA_DIFF_RADIUS, boost::test_tools::per_element());
clsa1.setSeqNo(14);
wire = clsa1.wireEncode();
- BOOST_CHECK_EQUAL_COLLECTIONS(COORDINATE_LSA_DIFF_SEQ,
- COORDINATE_LSA_DIFF_SEQ + sizeof(COORDINATE_LSA_DIFF_SEQ),
- wire.begin(), wire.end());
+ BOOST_TEST(wire == COORDINATE_LSA_DIFF_SEQ, boost::test_tools::per_element());
- testTimePoint =
- ndn::time::fromUnixTimestamp(ndn::time::milliseconds(1585196024993));
+ testTimePoint = ndn::time::fromUnixTimestamp(ndn::time::milliseconds(1585196024993));
clsa1.setExpirationTimePoint(testTimePoint);
wire = clsa1.wireEncode();
- BOOST_CHECK_EQUAL_COLLECTIONS(COORDINATE_LSA_DIFF_TS,
- COORDINATE_LSA_DIFF_TS + sizeof(COORDINATE_LSA_DIFF_TS),
- wire.begin(), wire.end());
+ BOOST_TEST(wire == COORDINATE_LSA_DIFF_TS, boost::test_tools::per_element());
}
BOOST_AUTO_TEST_CASE(IncrementAdjacentNumber)
@@ -417,11 +397,11 @@
knownNameLsa.addName("/yoursunny/_/dal");
knownNameLsa.addName("/ndn");
- std::shared_ptr<Lsa> rcvdLsa = std::make_shared<NameLsa>();
-
+ auto rcvdLsa = std::make_shared<NameLsa>();
rcvdLsa->m_originRouter = ndn::Name("/yoursunny/_/%C1.Router/dal");
rcvdLsa->m_seqNo = 2684;
rcvdLsa->setExpirationTimePoint(ndn::time::system_clock::now() + 3600_ms);
+
auto nlsa = std::static_pointer_cast<NameLsa>(rcvdLsa);
nlsa->addName("/ndn");
nlsa->addName("/yoursunny/_/dal");
@@ -430,12 +410,11 @@
nlsa->addName(addedName1);
nlsa->addName(addedName2);
- bool updated;
- std::list<ndn::Name> namesToAdd, namesToRemove;
- std::tie(updated, namesToAdd, namesToRemove) = knownNameLsa.update(rcvdLsa);
+ auto [updated, namesToAdd, namesToRemove] = knownNameLsa.update(rcvdLsa);
- BOOST_CHECK_EQUAL(namesToRemove.size(), 0);
+ BOOST_CHECK_EQUAL(updated, true);
BOOST_CHECK_EQUAL(namesToAdd.size(), 2);
+ BOOST_CHECK_EQUAL(namesToRemove.size(), 0);
auto it = std::find(namesToAdd.begin(), namesToAdd.end(), addedName1);
BOOST_CHECK(it != namesToAdd.end());
it = std::find(namesToAdd.begin(), namesToAdd.end(), addedName2);
diff --git a/tests/test-name-prefix-list.cpp b/tests/test-name-prefix-list.cpp
index 687d6c3..b62ab31 100644
--- a/tests/test-name-prefix-list.cpp
+++ b/tests/test-name-prefix-list.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2020, The University of Memphis,
+/*
+ * Copyright (c) 2014-2022, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
#include "name-prefix-list.hpp"
#include "tests/boost-test.hpp"
@@ -87,7 +87,7 @@
The NamePrefixList will count the number of sources for a given
name, with zero for a non-existent name.
*/
-BOOST_AUTO_TEST_CASE(countSources)
+BOOST_AUTO_TEST_CASE(CountSources)
{
const ndn::Name name1{"/ndn/test/prefix1"};
const ndn::Name invalidName{"/not/a/prefix"};
@@ -104,7 +104,7 @@
The NamePrefixList will return a container with all the sources for
a given name, with an empty container for a non-existent name.
*/
-BOOST_AUTO_TEST_CASE(getSources)
+BOOST_AUTO_TEST_CASE(GetSources)
{
NamePrefixList list;
const ndn::Name name1{"/ndn/test/prefix1"};
@@ -183,10 +183,6 @@
const std::vector<ndn::Name> namesVector{name1, name2, name3};
NamePrefixList list3(namesVector);
BOOST_CHECK(list1 == list3);
-
- const std::list<ndn::Name> namesList{name1, name2, name3};
- NamePrefixList list4(namesList);
- BOOST_CHECK(list1 == list4);
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index 1ea89dc..9385790 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.cpp
@@ -125,7 +125,7 @@
BOOST_CHECK(!wasValidated);
}
-BOOST_AUTO_TEST_CASE(onReceiveInterestRegisterCommand)
+BOOST_AUTO_TEST_CASE(OnReceiveInterestRegisterCommand)
{
ndn::Name name("/localhost/nlsr/rib/register");
ndn::Name prefixName("/test/prefixA");
@@ -145,7 +145,7 @@
BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.m_lsdb.m_sequencingManager.getNameLsaSeq());
}
-BOOST_AUTO_TEST_CASE(onReceiveInterestUnregisterCommand)
+BOOST_AUTO_TEST_CASE(OnReceiveInterestUnregisterCommand)
{
ndn::Name name("/localhost/nlsr/rib/unregister");
ndn::Name prefixName("/test/prefixA");
@@ -161,7 +161,7 @@
BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.m_lsdb.m_sequencingManager.getNameLsaSeq());
}
-BOOST_AUTO_TEST_CASE(onReceiveInterestInvalidPrefix)
+BOOST_AUTO_TEST_CASE(OnReceiveInterestInvalidPrefix)
{
ndn::Name name("/localhost/invalid/rib/register");
ndn::Name prefixName("/test/prefixA");