Avoid deprecated ndn-cxx functions
Change-Id: I763368c2ea12902b4ea400f92c23b17ad5a5628e
diff --git a/tests/route/test-nexthop.cpp b/tests/route/test-nexthop.cpp
index a11c221..3ba3539 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-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).
@@ -26,13 +26,13 @@
BOOST_AUTO_TEST_SUITE(TestNexthop)
-double
+static double
getHyperbolicAdjustedDecimal(unsigned int i)
{
return static_cast<double>(i)/(10*NextHop::HYPERBOLIC_COST_ADJUSTMENT_FACTOR);
}
-uint64_t
+static uint64_t
applyHyperbolicFactorAndRound(double d)
{
return round(NextHop::HYPERBOLIC_COST_ADJUSTMENT_FACTOR*d);
@@ -117,17 +117,13 @@
nexthops1.setConnectingFaceUri("/test/nexthop/tlv");
nexthops1.setRouteCost(1.65);
- const ndn::Block& wire = nexthops1.wireEncode();
- BOOST_REQUIRE_EQUAL_COLLECTIONS(NexthopData,
- NexthopData + sizeof(NexthopData),
- wire.begin(), wire.end());
+ BOOST_TEST(nexthops1.wireEncode() == NexthopData, boost::test_tools::per_element());
}
BOOST_AUTO_TEST_CASE(NexthopDecode)
{
NextHop nexthops1;
-
- nexthops1.wireDecode(ndn::Block(NexthopData, sizeof(NexthopData)));
+ nexthops1.wireDecode(ndn::Block{NexthopData});
BOOST_REQUIRE_EQUAL(nexthops1.getConnectingFaceUri(), "/test/nexthop/tlv");
BOOST_REQUIRE_EQUAL(nexthops1.getRouteCost(), 1.65);
diff --git a/tests/route/test-routing-table-entry.cpp b/tests/route/test-routing-table-entry.cpp
index c17b981..ef470e1 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-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).
@@ -69,18 +69,13 @@
nexthops2.setRouteCost(1.65);
rte.getNexthopList().addNextHop(nexthops2);
- const ndn::Block& wire = rte.wireEncode();
-
- BOOST_REQUIRE_EQUAL_COLLECTIONS(RoutingTableEntryWithNexthopsData,
- RoutingTableEntryWithNexthopsData +
- sizeof(RoutingTableEntryWithNexthopsData),
- wire.begin(), wire.end());
+ BOOST_TEST(rte.wireEncode() == RoutingTableEntryWithNexthopsData,
+ boost::test_tools::per_element());
}
BOOST_AUTO_TEST_CASE(RoutingTableEntryDecodeWithNexthops)
{
- RoutingTableEntry rte(ndn::Block(RoutingTableEntryWithNexthopsData,
- sizeof(RoutingTableEntryWithNexthopsData)));
+ RoutingTableEntry rte(ndn::Block{RoutingTableEntryWithNexthopsData});
BOOST_CHECK_EQUAL(rte.getDestination(), "dest1");
BOOST_CHECK(rte.getNexthopList().size() != 0);
@@ -96,25 +91,17 @@
BOOST_AUTO_TEST_CASE(RoutingTableEntryEncodeWithoutNexthops)
{
RoutingTableEntry rte(ndn::Name("dest1"));
-
- auto wire = rte.wireEncode();
-
- BOOST_REQUIRE_EQUAL_COLLECTIONS(RoutingTableEntryWithoutNexthopsData,
- RoutingTableEntryWithoutNexthopsData +
- sizeof(RoutingTableEntryWithoutNexthopsData),
- wire.begin(), wire.end());
+ BOOST_TEST(rte.wireEncode() == RoutingTableEntryWithoutNexthopsData,
+ boost::test_tools::per_element());
}
BOOST_AUTO_TEST_CASE(RoutingTableEntryDecodeWithoutNexthops)
{
- RoutingTableEntry rte(ndn::Block(RoutingTableEntryWithoutNexthopsData,
- sizeof(RoutingTableEntryWithoutNexthopsData)));
-
+ RoutingTableEntry rte(ndn::Block{RoutingTableEntryWithoutNexthopsData});
BOOST_CHECK_EQUAL(rte.getDestination(), "dest1");
- BOOST_CHECK(rte.getNexthopList().size() == 0);
+ BOOST_CHECK_EQUAL(rte.getNexthopList().size(), 0);
}
-
BOOST_AUTO_TEST_CASE(RoutingTableEntryClear)
{
RoutingTableEntry rte(ndn::Name("dest1"));
diff --git a/tests/route/test-routing-table.cpp b/tests/route/test-routing-table.cpp
index 6a2971e..5624ad8 100644
--- a/tests/route/test-routing-table.cpp
+++ b/tests/route/test-routing-table.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, 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).
@@ -102,7 +102,7 @@
BOOST_FIXTURE_TEST_CASE(RoutingTableDecode1, RoutingTableFixture)
{
- RoutingTableStatus rtStatus(ndn::Block(RoutingTableData1, sizeof(RoutingTableData1)));
+ RoutingTableStatus rtStatus(ndn::Block{RoutingTableData1});
auto it1 = rtStatus.m_rTable.begin();