build: migrate to C++17
Change-Id: Ic9f09efd20b608bfcb713fd319834b2666cf6242
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);