build: align minimum build dependencies with ndn-cxx
* boost 1.65.1
* gcc 7.4
* clang 6.0
* Xcode 10.0 (11.3 or later recommended)
Also improve some test cases
Change-Id: Ib81d082a19e61940fa6f1d89204ea8de8ed57940
diff --git a/tests/communication/test-sync-logic-handler.cpp b/tests/communication/test-sync-logic-handler.cpp
index 55007b8..3c71f74 100644
--- a/tests/communication/test-sync-logic-handler.cpp
+++ b/tests/communication/test-sync-logic-handler.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,
* Arizona Board of Regents.
*
@@ -36,13 +36,7 @@
{
public:
SyncLogicFixture()
- : face(m_ioService, m_keyChain)
- , conf(face, m_keyChain)
- , confProcessor(conf, SYNC_PROTOCOL_PSYNC)
- , testIsLsaNew([] (const ndn::Name& name, const Lsa::Type& lsaType,
- const uint64_t sequenceNumber) {
- return true;
- })
+ : testIsLsaNew([] (auto&&...) { return true; })
, sync(face, testIsLsaNew, conf)
, updateNamePrefix(this->conf.getLsaPrefix().toUri() +
this->conf.getSiteName().toUri() +
@@ -65,146 +59,156 @@
}
public:
- ndn::util::DummyClientFace face;
- ConfParameter conf;
- DummyConfFileProcessor confProcessor;
+ ndn::util::DummyClientFace face{m_ioService, m_keyChain};
+ ConfParameter conf{face, m_keyChain};
+ DummyConfFileProcessor confProcessor{conf, SYNC_PROTOCOL_PSYNC};
SyncLogicHandler::IsLsaNew testIsLsaNew;
SyncLogicHandler sync;
const std::string updateNamePrefix;
- const std::vector<Lsa::Type> lsaTypes = {Lsa::Type::NAME, Lsa::Type::ADJACENCY,
- Lsa::Type::COORDINATE};
+ const std::vector<Lsa::Type> lsaTypes = {Lsa::Type::NAME,
+ Lsa::Type::ADJACENCY,
+ Lsa::Type::COORDINATE};
};
-BOOST_AUTO_TEST_SUITE(TestSyncLogicHandler)
+BOOST_FIXTURE_TEST_SUITE(TestSyncLogicHandler, SyncLogicFixture)
/* Tests that when SyncLogicHandler receives an LSA of either Name or
Adjacency type that appears to be newer, it will emit to its signal
with those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE(UpdateForOtherLS, SyncLogicFixture)
+BOOST_AUTO_TEST_CASE(UpdateForOtherLS)
{
- std::vector<Lsa::Type> lsaTypes = {Lsa::Type::NAME, Lsa::Type::ADJACENCY};
-
+ size_t nCallbacks = 0;
uint64_t syncSeqNo = 1;
- for (const Lsa::Type& lsaType : lsaTypes) {
+ for (auto lsaType : {Lsa::Type::NAME, Lsa::Type::ADJACENCY}) {
std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType);
- // Actual testing done here -- signal function callback
ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa->connect(
- [&] (const ndn::Name& routerName, const uint64_t& sequenceNumber,
- const ndn::Name& originRouter) {
+ [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter) {
BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName);
BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo);
+ ++nCallbacks;
});
this->receiveUpdate(updateName, syncSeqNo);
}
+
+ BOOST_CHECK_EQUAL(nCallbacks, 2);
}
/* Tests that when SyncLogicHandler in HR mode receives an LSA of
either Coordinate or Name type that appears to be newer, it will
emit to its signal with those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE(UpdateForOtherHR, SyncLogicFixture)
+BOOST_AUTO_TEST_CASE(UpdateForOtherHR)
{
this->conf.setHyperbolicState(HYPERBOLIC_STATE_ON);
+ size_t nCallbacks = 0;
uint64_t syncSeqNo = 1;
- std::vector<Lsa::Type> lsaTypes = {Lsa::Type::NAME, Lsa::Type::COORDINATE};
- for (const Lsa::Type& lsaType : lsaTypes) {
+ for (auto lsaType : {Lsa::Type::NAME, Lsa::Type::COORDINATE}) {
std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType);
ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa->connect(
- [&] (const ndn::Name& routerName, const uint64_t& sequenceNumber,
- const ndn::Name& originRouter) {
+ [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter) {
BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName);
BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo);
+ ++nCallbacks;
});
this->receiveUpdate(updateName, syncSeqNo);
}
+
+ BOOST_CHECK_EQUAL(nCallbacks, 2);
}
/* Tests that when SyncLogicHandler in HR-dry mode receives an LSA of
any type that appears to be newer, it will emit to its signal with
those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE(UpdateForOtherHRDry, SyncLogicFixture)
+BOOST_AUTO_TEST_CASE(UpdateForOtherHRDry)
{
this->conf.setHyperbolicState(HYPERBOLIC_STATE_DRY_RUN);
+ size_t nCallbacks = 0;
uint64_t syncSeqNo = 1;
- for (const Lsa::Type& lsaType : this->lsaTypes) {
+ for (auto lsaType : this->lsaTypes) {
std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType);
ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa->connect(
- [&] (const ndn::Name& routerName, const uint64_t& sequenceNumber,
- const ndn::Name& originRouter) {
+ [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter) {
BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName);
BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo);
+ ++nCallbacks;
});
this->receiveUpdate(updateName, syncSeqNo);
}
+
+ BOOST_CHECK_EQUAL(nCallbacks, 3);
}
/* Tests that when SyncLogicHandler receives an update for an LSA with
details matching this router's details, it will *not* emit to its
signal those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE(NoUpdateForSelf, SyncLogicFixture)
+BOOST_AUTO_TEST_CASE(NoUpdateForSelf)
{
const uint64_t sequenceNumber = 1;
- for (const Lsa::Type& lsaType : this->lsaTypes) {
+ for (auto lsaType : this->lsaTypes) {
// To ensure that we get correctly-separated components, create
// and modify a Name to hand off.
- ndn::Name updateName = ndn::Name{this->conf.getLsaPrefix()};
+ ndn::Name updateName{this->conf.getLsaPrefix()};
updateName.append(this->conf.getSiteName())
.append(this->conf.getRouterName())
.append(boost::lexical_cast<std::string>(lsaType));
ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa->connect(
- [&] (const ndn::Name& routerName, const uint64_t& sequenceNumber,
- const ndn::Name& originRouter) {
+ [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter) {
BOOST_FAIL("Updates for self should not be emitted!");
});
this->receiveUpdate(updateName.toUri(), sequenceNumber);
}
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
/* Tests that when SyncLogicHandler receives an update for an LSA with
details that do not match the expected format, it will *not* emit
to its signal those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE(MalformedUpdate, SyncLogicFixture)
+BOOST_AUTO_TEST_CASE(MalformedUpdate)
{
const uint64_t sequenceNumber = 1;
- for (const Lsa::Type& lsaType : this->lsaTypes) {
+ for (auto lsaType : this->lsaTypes) {
ndn::Name updateName{this->conf.getSiteName()};
updateName.append(this->conf.getRouterName()).append(boost::lexical_cast<std::string>(lsaType));
ndn::util::signal::ScopedConnection connection = this->sync.onNewLsa->connect(
- [&] (const ndn::Name& routerName, const uint64_t& sequenceNumber,
- const ndn::Name& originRouter) {
+ [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter) {
BOOST_FAIL("Malformed updates should not be emitted!");
});
this->receiveUpdate(updateName.toUri(), sequenceNumber);
}
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
/* Tests that when SyncLogicHandler receives an update for an LSA with
details that do not appear to be new, it will *not* emit to its
signal those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE(LsaNotNew, SyncLogicFixture)
+BOOST_AUTO_TEST_CASE(LsaNotNew)
{
auto testLsaAlwaysFalse = [] (const ndn::Name& routerName, const Lsa::Type& lsaType,
const uint64_t& sequenceNumber) {
@@ -214,21 +218,22 @@
const uint64_t sequenceNumber = 1;
SyncLogicHandler sync{this->face, testLsaAlwaysFalse, this->conf};
ndn::util::signal::ScopedConnection connection = sync.onNewLsa->connect(
- [&] (const ndn::Name& routerName, const uint64_t& sequenceNumber,
- const ndn::Name& originRouter) {
+ [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter) {
BOOST_FAIL("An update for an LSA with non-new sequence number should not emit!");
});
std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(Lsa::Type::NAME);
-
this->receiveUpdate(updateName, sequenceNumber);
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
/* Tests that SyncLogicHandler successfully concatenates configured
variables together to form the necessary prefixes to advertise
through sync.
*/
-BOOST_FIXTURE_TEST_CASE(UpdatePrefix, SyncLogicFixture)
+BOOST_AUTO_TEST_CASE(UpdatePrefix)
{
ndn::Name expectedPrefix = this->conf.getLsaPrefix();
expectedPrefix.append(this->conf.getSiteName());
diff --git a/tests/publisher/test-dataset-interest-handler.cpp b/tests/publisher/test-dataset-interest-handler.cpp
index 698895e..b8a44d3 100644
--- a/tests/publisher/test-dataset-interest-handler.cpp
+++ b/tests/publisher/test-dataset-interest-handler.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,
* Arizona Board of Regents.
*
@@ -46,11 +46,11 @@
face.sentData.clear();
}
-BOOST_FIXTURE_TEST_SUITE(PublisherTestLsdbDatasetInterestHandler, PublisherFixture)
+BOOST_FIXTURE_TEST_SUITE(TestDatasetInterestHandler, PublisherFixture)
BOOST_AUTO_TEST_CASE(Localhost)
{
- nlsr::test::checkPrefixRegistered(face, Nlsr::LOCALHOST_PREFIX);
+ checkPrefixRegistered(face, Nlsr::LOCALHOST_PREFIX);
// Install adjacency LSA
AdjLsa adjLsa;
@@ -102,7 +102,7 @@
// Should already be added to dispatcher
BOOST_CHECK_THROW(nlsr.m_dispatcher.addTopPrefix(regRouterPrefix), std::out_of_range);
- nlsr::test::checkPrefixRegistered(face,regRouterPrefix);
+ checkPrefixRegistered(face,regRouterPrefix);
// Install adjacencies LSA
AdjLsa adjLsa;
diff --git a/tests/route/test-fib.cpp b/tests/route/test-fib.cpp
index 3961b05..5c75314 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-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).
@@ -19,11 +19,12 @@
*/
#include "route/fib.hpp"
-#include "../test-common.hpp"
-#include "../control-commands.hpp"
#include "adjacency-list.hpp"
#include "conf-parameter.hpp"
+#include "../test-common.hpp"
+#include "../control-commands.hpp"
+
#include <ndn-cxx/util/dummy-client-face.hpp>
namespace nlsr {
@@ -335,11 +336,11 @@
int origSeqNo = fe.seqNo;
fib.m_table.emplace(name1, std::move(fe));
- fib.scheduleEntryRefresh(fe,
- [&] (FibEntry& entry) {
- BOOST_CHECK_EQUAL(origSeqNo + 1, entry.seqNo);
- });
+ fib.scheduleEntryRefresh(fe, [&] (auto& entry) { BOOST_CHECK_EQUAL(origSeqNo + 1, entry.seqNo); });
this->advanceClocks(ndn::time::milliseconds(10), 1);
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
BOOST_AUTO_TEST_CASE(ShouldNotRefreshNeighborRoute) // #4799
diff --git a/tests/test-hello-protocol.cpp b/tests/test-hello-protocol.cpp
index 742d129..08adc02 100644
--- a/tests/test-hello-protocol.cpp
+++ b/tests/test-hello-protocol.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,
* Arizona Board of Regents.
*
@@ -95,7 +95,7 @@
const std::string ACTIVE_NEIGHBOR = "/ndn/site/%C1.Router/router-active";
};
-BOOST_FIXTURE_TEST_SUITE(HelloProtocol, HelloProtocolFixture)
+BOOST_FIXTURE_TEST_SUITE(TestHelloProtocol, HelloProtocolFixture)
BOOST_AUTO_TEST_CASE(Basic)
{
@@ -150,4 +150,4 @@
BOOST_AUTO_TEST_SUITE_END()
} // namespace test
-} // namespace nlsr
\ No newline at end of file
+} // namespace nlsr
diff --git a/tests/test-lsa-rule.cpp b/tests/test-lsa-rule.cpp
index 4e7b3b3..2b6faf4 100644
--- a/tests/test-lsa-rule.cpp
+++ b/tests/test-lsa-rule.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,
* Arizona Board of Regents.
*
@@ -39,7 +39,7 @@
namespace nlsr {
namespace test {
-class LsaRuleFixture : public nlsr::test::UnitTestTimeFixture
+class LsaRuleFixture : public UnitTestTimeFixture
{
public:
LsaRuleFixture()
diff --git a/tests/update/test-advertise-crash.cpp b/tests/update/test-advertise-crash.cpp
index d6aea8a..09a27d7 100644
--- a/tests/update/test-advertise-crash.cpp
+++ b/tests/update/test-advertise-crash.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,
* Arizona Board of Regents.
*
@@ -26,7 +26,7 @@
namespace nlsr {
namespace test {
-class AdvertiseCrashFixture : public nlsr::test::UnitTestTimeFixture
+class AdvertiseCrashFixture : public UnitTestTimeFixture
{
public:
AdvertiseCrashFixture()
@@ -70,7 +70,9 @@
NamePrefixList& namePrefixList;
};
-BOOST_FIXTURE_TEST_CASE(TestAdvertiseCrash, AdvertiseCrashFixture)
+BOOST_FIXTURE_TEST_SUITE(TestAdvertiseCrash, AdvertiseCrashFixture)
+
+BOOST_AUTO_TEST_CASE(ReceiveAdvertiseInterest)
{
// Note that this test does not setup any security
// and the interest will be rejected by NLSR.
@@ -84,10 +86,14 @@
advertiseCommand.append(parameters.wireEncode());
auto advertiseInterest = std::make_shared<ndn::Interest>(advertiseCommand);
- advertiseInterest->setCanBePrefix(false);
face.receive(*advertiseInterest);
this->advanceClocks(ndn::time::milliseconds(10), 10);
+
+ // avoid "test case [...] did not check any assertions" message from Boost.Test
+ BOOST_CHECK(true);
}
+BOOST_AUTO_TEST_SUITE_END()
+
} // namespace test
} // namespace nlsr
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index ef8c1b6..cc23dd0 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.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,
* Arizona Board of Regents.
*
@@ -32,7 +32,7 @@
namespace nlsr {
namespace test {
-class NfdRibCommandProcessorFixture : public nlsr::test::UnitTestTimeFixture
+class NfdRibCommandProcessorFixture : public UnitTestTimeFixture
{
public:
NfdRibCommandProcessorFixture()
@@ -55,7 +55,6 @@
sendCommand(ndn::Name prefix, const ndn::nfd::ControlParameters& parameters)
{
ndn::Interest interest(prefix.append(parameters.wireEncode()));
- interest.setCanBePrefix(false);
face.receive(interest);
this->advanceClocks(ndn::time::milliseconds(10), 10);
}
diff --git a/tests/update/test-prefix-update-processor.cpp b/tests/update/test-prefix-update-processor.cpp
index fe0bfac..9c20114 100644
--- a/tests/update/test-prefix-update-processor.cpp
+++ b/tests/update/test-prefix-update-processor.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,
* Arizona Board of Regents.
*
@@ -40,7 +40,7 @@
namespace nlsr {
namespace test {
-class PrefixUpdateFixture : public nlsr::test::UnitTestTimeFixture
+class PrefixUpdateFixture : public UnitTestTimeFixture
{
public:
PrefixUpdateFixture()