tests: respect naming conventions and improve nesting of some test suites
Change-Id: I65af858bc6d10197c6ee11111fa9f7c1faa617ef
Refs: #2497
diff --git a/tests/daemon/face/lp-reassembler.t.cpp b/tests/daemon/face/lp-reassembler.t.cpp
index 5b62d4e..9cfa8dd 100644
--- a/tests/daemon/face/lp-reassembler.t.cpp
+++ b/tests/daemon/face/lp-reassembler.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -33,11 +33,9 @@
using namespace nfd::tests;
-BOOST_AUTO_TEST_SUITE(Face)
-
class LpReassemblerFixture : public UnitTestTimeFixture
{
-public:
+protected:
LpReassemblerFixture()
{
reassembler.beforeTimeout.connect(
@@ -46,7 +44,7 @@
});
}
-public:
+protected:
LpReassembler reassembler;
std::vector<std::tuple<Transport::EndpointId, size_t>> timeoutHistory;
@@ -58,6 +56,7 @@
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
};
+BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestLpReassembler, LpReassemblerFixture)
BOOST_AUTO_TEST_SUITE(SingleFragment)
@@ -460,7 +459,9 @@
BOOST_AUTO_TEST_SUITE_END() // MultiFragment
-BOOST_AUTO_TEST_CASE(MultiRemoteEndpoints)
+BOOST_AUTO_TEST_SUITE(MultipleRemoteEndpoints)
+
+BOOST_AUTO_TEST_CASE(Normal)
{
ndn::Buffer data1Buffer(data, 5);
ndn::Buffer data2Buffer(data + 5, 5);
@@ -510,6 +511,8 @@
BOOST_CHECK_EQUAL(reassembler.size(), 0);
}
+BOOST_AUTO_TEST_SUITE_END() // MultipleRemoteEndpoints
+
BOOST_AUTO_TEST_SUITE_END() // TestLpReassembler
BOOST_AUTO_TEST_SUITE_END() // Face
diff --git a/tests/daemon/face/transport.t.cpp b/tests/daemon/face/transport.t.cpp
index 75bedf8..f1171e5 100644
--- a/tests/daemon/face/transport.t.cpp
+++ b/tests/daemon/face/transport.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -41,15 +41,11 @@
namespace tests {
using namespace nfd::tests;
-namespace ip = boost::asio::ip;
-
-BOOST_AUTO_TEST_SUITE(Face)
-
-using nfd::Face;
+namespace mpl = boost::mpl;
class DummyTransportFixture : public BaseFixture
{
-public:
+protected:
DummyTransportFixture()
: transport(nullptr)
, sentPackets(nullptr)
@@ -68,13 +64,14 @@
this->receivedPackets = &static_cast<DummyReceiveLinkService*>(face->getLinkService())->receivedPackets;
}
-public:
+protected:
unique_ptr<Face> face;
DummyTransport* transport;
std::vector<Transport::Packet>* sentPackets;
std::vector<Transport::Packet>* receivedPackets;
};
+BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestTransport, DummyTransportFixture)
BOOST_AUTO_TEST_CASE(DummyTransportStaticProperties)
@@ -83,10 +80,6 @@
checkStaticPropertiesInitialized(*transport);
}
-BOOST_AUTO_TEST_SUITE(StateTransition)
-
-namespace mpl = boost::mpl;
-
/** \brief a macro to declare a TransportState as a integral constant
*/
#define TRANSPORT_STATE_C(X) mpl::int_<static_cast<int>(TransportState::X)>
@@ -198,8 +191,6 @@
}
}
-BOOST_AUTO_TEST_SUITE_END() // StateTransition
-
BOOST_AUTO_TEST_CASE(NoExpirationTime)
{
initialize();
diff --git a/tests/daemon/fw/retx-suppression.t.cpp b/tests/daemon/fw/retx-suppression.t.cpp
index 7013aef..604dfb1 100644
--- a/tests/daemon/fw/retx-suppression.t.cpp
+++ b/tests/daemon/fw/retx-suppression.t.cpp
@@ -36,7 +36,8 @@
using namespace nfd::tests;
-BOOST_FIXTURE_TEST_SUITE(FwRetxSuppression, UnitTestTimeFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_FIXTURE_TEST_SUITE(TestRetxSuppression, UnitTestTimeFixture)
BOOST_AUTO_TEST_CASE(Fixed)
{
@@ -155,7 +156,8 @@
// suppression interval is 100ms, until 304ms
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestRetxSuppression
+BOOST_AUTO_TEST_SUITE_END() // Fw
} // namespace tests
} // namespace fw
diff --git a/tests/daemon/fw/rtt-estimator.t.cpp b/tests/daemon/fw/rtt-estimator.t.cpp
index 1a19443..b2c3fb6 100644
--- a/tests/daemon/fw/rtt-estimator.t.cpp
+++ b/tests/daemon/fw/rtt-estimator.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -30,7 +30,8 @@
namespace nfd {
namespace tests {
-BOOST_FIXTURE_TEST_SUITE(FwRttEstimator, BaseFixture)
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_FIXTURE_TEST_SUITE(TestRttEstimator, BaseFixture)
static inline double
computeRtoAsFloatSeconds(RttEstimator& rtt)
@@ -74,7 +75,8 @@
BOOST_CHECK_GT(rto6, rto1);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestRttEstimator
+BOOST_AUTO_TEST_SUITE_END() // Fw
} // namespace tests
} // namespace nfd
diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index 3c4ef9b..f9d5de8 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -23,8 +23,8 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NFD_TESTS_NFD_FW_STRATEGY_TESTER_HPP
-#define NFD_TESTS_NFD_FW_STRATEGY_TESTER_HPP
+#ifndef NFD_TESTS_DAEMON_FW_STRATEGY_TESTER_HPP
+#define NFD_TESTS_DAEMON_FW_STRATEGY_TESTER_HPP
#include <boost/tuple/tuple_comparison.hpp>
#include "fw/strategy.hpp"
@@ -105,4 +105,4 @@
} // namespace fw
} // namespace nfd
-#endif // NFD_TESTS_NFD_FW_STRATEGY_TESTER_HPP
+#endif // NFD_TESTS_DAEMON_FW_STRATEGY_TESTER_HPP
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
index d934e35..5742592 100644
--- a/tests/daemon/fw/topology-tester.cpp
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -75,7 +75,7 @@
return;
}
- for (auto&& p : m_transports) {
+ for (const auto& p : m_transports) {
if (p.first == i) {
continue;
}
diff --git a/tests/daemon/fw/topology-tester.hpp b/tests/daemon/fw/topology-tester.hpp
index 329244b..e5b21da 100644
--- a/tests/daemon/fw/topology-tester.hpp
+++ b/tests/daemon/fw/topology-tester.hpp
@@ -27,16 +27,17 @@
* \brief allows testing forwarding in a network topology
*/
-#ifndef NFD_TESTS_NFD_FW_TOPOLOGY_TESTER_HPP
-#define NFD_TESTS_NFD_FW_TOPOLOGY_TESTER_HPP
+#ifndef NFD_TESTS_DAEMON_FW_TOPOLOGY_TESTER_HPP
+#define NFD_TESTS_DAEMON_FW_TOPOLOGY_TESTER_HPP
-#include <ndn-cxx/face.hpp>
#include "face/internal-transport.hpp"
#include "face/face.hpp"
#include "fw/strategy.hpp"
#include "install-strategy.hpp"
#include "tests/test-common.hpp"
+#include <ndn-cxx/face.hpp>
+
namespace nfd {
namespace fw {
namespace tests {
@@ -236,4 +237,4 @@
} // namespace fw
} // namespace nfd
-#endif // NFD_TESTS_NFD_FW_TOPOLOGY_TESTER_HPP
+#endif // NFD_TESTS_DAEMON_FW_TOPOLOGY_TESTER_HPP
diff --git a/tests/daemon/mgmt/face-manager-command-fixture.hpp b/tests/daemon/mgmt/face-manager-command-fixture.hpp
index fcb89a4..8d66309 100644
--- a/tests/daemon/mgmt/face-manager-command-fixture.hpp
+++ b/tests/daemon/mgmt/face-manager-command-fixture.hpp
@@ -29,18 +29,17 @@
#include "mgmt/face-manager.hpp"
#include "fw/face-table.hpp"
+#include "tests/identity-management-fixture.hpp"
+
#include <ndn-cxx/mgmt/dispatcher.hpp>
#include <ndn-cxx/util/dummy-client-face.hpp>
-#include "tests/identity-management-fixture.hpp"
-
namespace nfd {
namespace tests {
class FaceManagerCommandNode
{
public:
- explicit
FaceManagerCommandNode(ndn::KeyChain& keyChain, uint16_t port);
~FaceManagerCommandNode();
diff --git a/tests/daemon/mgmt/face-manager.t.cpp b/tests/daemon/mgmt/face-manager.t.cpp
index ec37c57..c189894 100644
--- a/tests/daemon/mgmt/face-manager.t.cpp
+++ b/tests/daemon/mgmt/face-manager.t.cpp
@@ -24,11 +24,12 @@
*/
#include "mgmt/face-manager.hpp"
-#include "nfd-manager-common-fixture.hpp"
-#include "../face/dummy-face.hpp"
#include "face/tcp-factory.hpp"
#include "face/udp-factory.hpp"
+#include "nfd-manager-common-fixture.hpp"
+#include "../face/dummy-face.hpp"
+
#include <ndn-cxx/util/random.hpp>
#include <ndn-cxx/encoding/tlv.hpp>
#include <ndn-cxx/mgmt/nfd/channel-status.hpp>
@@ -37,8 +38,6 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(Mgmt)
-
class FaceManagerFixture : public NfdManagerCommonFixture
{
public:
@@ -112,6 +111,7 @@
FaceManager m_manager;
};
+BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_FIXTURE_TEST_SUITE(TestFaceManager, FaceManagerFixture)
BOOST_AUTO_TEST_SUITE(DestroyFace)
@@ -149,94 +149,7 @@
BOOST_AUTO_TEST_SUITE_END() // DestroyFace
-BOOST_AUTO_TEST_CASE(FaceEvents)
-{
- auto addedFace = addFace(); // trigger FACE_EVENT_CREATED notification
- BOOST_CHECK_NE(addedFace->getId(), -1);
- int64_t faceId = addedFace->getId();
-
- // check notification
- {
- Block payload;
- ndn::nfd::FaceEventNotification notification;
- BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
- BOOST_CHECK_NO_THROW(payload = m_responses[0].getContent().blockFromValue());
- BOOST_CHECK_EQUAL(payload.type(), ndn::tlv::nfd::FaceEventNotification);
- BOOST_CHECK_NO_THROW(notification.wireDecode(payload));
- BOOST_CHECK_EQUAL(notification.getKind(), ndn::nfd::FACE_EVENT_CREATED);
- BOOST_CHECK_EQUAL(notification.getFaceId(), faceId);
- BOOST_CHECK_EQUAL(notification.getRemoteUri(), addedFace->getRemoteUri().toString());
- BOOST_CHECK_EQUAL(notification.getLocalUri(), addedFace->getLocalUri().toString());
- BOOST_CHECK_EQUAL(notification.getFaceScope(), ndn::nfd::FACE_SCOPE_NON_LOCAL);
- BOOST_CHECK_EQUAL(notification.getFacePersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
- BOOST_CHECK_EQUAL(notification.getLinkType(), ndn::nfd::LinkType::LINK_TYPE_POINT_TO_POINT);
- }
-
- addedFace->close(); // trigger FaceDestroy FACE_EVENT_DESTROYED
- advanceClocks(time::milliseconds(1), 10);
-
- // check notification
- {
- Block payload;
- ndn::nfd::FaceEventNotification notification;
- BOOST_REQUIRE_EQUAL(m_responses.size(), 2);
- BOOST_CHECK_NO_THROW(payload = m_responses[1].getContent().blockFromValue());
- BOOST_CHECK_EQUAL(payload.type(), ndn::tlv::nfd::FaceEventNotification);
- BOOST_CHECK_NO_THROW(notification.wireDecode(payload));
- BOOST_CHECK_EQUAL(notification.getKind(), ndn::nfd::FACE_EVENT_DESTROYED);
- BOOST_CHECK_EQUAL(notification.getFaceId(), faceId);
- BOOST_CHECK_EQUAL(notification.getRemoteUri(), addedFace->getRemoteUri().toString());
- BOOST_CHECK_EQUAL(notification.getLocalUri(), addedFace->getLocalUri().toString());
- BOOST_CHECK_EQUAL(notification.getFaceScope(), ndn::nfd::FACE_SCOPE_NON_LOCAL);
- BOOST_CHECK_EQUAL(notification.getFacePersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
- BOOST_CHECK_EQUAL(notification.getLinkType(), ndn::nfd::LinkType::LINK_TYPE_POINT_TO_POINT);
- }
- BOOST_CHECK_EQUAL(addedFace->getId(), face::INVALID_FACEID);
-}
-
-// @todo Refactor when ndn::nfd::FaceStatus implementes operator!= and operator<<
-class FaceStatus : public ndn::nfd::FaceStatus
-{
-public:
- FaceStatus(const ndn::nfd::FaceStatus& s)
- : ndn::nfd::FaceStatus(s)
- {
- }
-};
-
-bool
-operator!=(const FaceStatus& left, const FaceStatus& right)
-{
- return left.getRemoteUri() != right.getRemoteUri() ||
- left.getLocalUri() != right.getLocalUri() ||
- left.getFaceScope() != right.getFaceScope() ||
- left.getFacePersistency() != right.getFacePersistency() ||
- left.getLinkType() != right.getLinkType() ||
- left.getFlags() != right.getFlags() ||
- left.getNInInterests() != right.getNInInterests() ||
- left.getNInDatas() != right.getNInDatas() ||
- left.getNOutInterests() != right.getNOutInterests() ||
- left.getNOutDatas() != right.getNOutDatas() ||
- left.getNInBytes() != right.getNInBytes() ||
- left.getNOutBytes() != right.getNOutBytes();
-}
-
-std::ostream&
-operator<<(std::ostream &os, const FaceStatus& status)
-{
- os << "[" << status.getRemoteUri() << ", "
- << status.getLocalUri() << ", "
- << status.getFacePersistency() << ", "
- << status.getLinkType() << ", "
- << status.getFlags() << ", "
- << status.getNInInterests() << ", "
- << status.getNInDatas() << ", "
- << status.getNOutInterests() << ", "
- << status.getNOutDatas() << ", "
- << status.getNInBytes() << ", "
- << status.getNOutBytes() << "]";
- return os;
-}
+BOOST_AUTO_TEST_SUITE(Datasets)
BOOST_AUTO_TEST_CASE(FaceDataset)
{
@@ -325,6 +238,7 @@
class TestChannel : public Channel
{
public:
+ explicit
TestChannel(const std::string& uri)
{
setUri(FaceUri(uri));
@@ -339,12 +253,12 @@
ndn::nfd::FacePersistency persistency,
bool wantLocalFieldsEnabled,
const FaceCreatedCallback& onCreated,
- const FaceCreationFailedCallback& onConnectFailed) override
+ const FaceCreationFailedCallback& onConnectFailed) final
{
}
virtual std::vector<shared_ptr<const Channel>>
- getChannels() const override
+ getChannels() const final
{
return m_channels;
}
@@ -390,6 +304,57 @@
}
}
+BOOST_AUTO_TEST_SUITE_END() // Datasets
+
+BOOST_AUTO_TEST_SUITE(Notifications)
+
+BOOST_AUTO_TEST_CASE(FaceEventNotification)
+{
+ auto addedFace = addFace(); // trigger FACE_EVENT_CREATED notification
+ BOOST_CHECK_NE(addedFace->getId(), -1);
+ int64_t faceId = addedFace->getId();
+
+ // check notification
+ {
+ Block payload;
+ ndn::nfd::FaceEventNotification notification;
+ BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
+ BOOST_CHECK_NO_THROW(payload = m_responses[0].getContent().blockFromValue());
+ BOOST_CHECK_EQUAL(payload.type(), ndn::tlv::nfd::FaceEventNotification);
+ BOOST_CHECK_NO_THROW(notification.wireDecode(payload));
+ BOOST_CHECK_EQUAL(notification.getKind(), ndn::nfd::FACE_EVENT_CREATED);
+ BOOST_CHECK_EQUAL(notification.getFaceId(), faceId);
+ BOOST_CHECK_EQUAL(notification.getRemoteUri(), addedFace->getRemoteUri().toString());
+ BOOST_CHECK_EQUAL(notification.getLocalUri(), addedFace->getLocalUri().toString());
+ BOOST_CHECK_EQUAL(notification.getFaceScope(), ndn::nfd::FACE_SCOPE_NON_LOCAL);
+ BOOST_CHECK_EQUAL(notification.getFacePersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
+ BOOST_CHECK_EQUAL(notification.getLinkType(), ndn::nfd::LinkType::LINK_TYPE_POINT_TO_POINT);
+ }
+
+ addedFace->close(); // trigger FaceDestroy FACE_EVENT_DESTROYED
+ advanceClocks(time::milliseconds(1), 10);
+
+ // check notification
+ {
+ Block payload;
+ ndn::nfd::FaceEventNotification notification;
+ BOOST_REQUIRE_EQUAL(m_responses.size(), 2);
+ BOOST_CHECK_NO_THROW(payload = m_responses[1].getContent().blockFromValue());
+ BOOST_CHECK_EQUAL(payload.type(), ndn::tlv::nfd::FaceEventNotification);
+ BOOST_CHECK_NO_THROW(notification.wireDecode(payload));
+ BOOST_CHECK_EQUAL(notification.getKind(), ndn::nfd::FACE_EVENT_DESTROYED);
+ BOOST_CHECK_EQUAL(notification.getFaceId(), faceId);
+ BOOST_CHECK_EQUAL(notification.getRemoteUri(), addedFace->getRemoteUri().toString());
+ BOOST_CHECK_EQUAL(notification.getLocalUri(), addedFace->getLocalUri().toString());
+ BOOST_CHECK_EQUAL(notification.getFaceScope(), ndn::nfd::FACE_SCOPE_NON_LOCAL);
+ BOOST_CHECK_EQUAL(notification.getFacePersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
+ BOOST_CHECK_EQUAL(notification.getLinkType(), ndn::nfd::LinkType::LINK_TYPE_POINT_TO_POINT);
+ }
+ BOOST_CHECK_EQUAL(addedFace->getId(), face::INVALID_FACEID);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // Notifications
+
BOOST_AUTO_TEST_SUITE_END() // TestFaceManager
BOOST_AUTO_TEST_SUITE_END() // Mgmt
diff --git a/tests/daemon/mgmt/fib-manager.t.cpp b/tests/daemon/mgmt/fib-manager.t.cpp
index 4bc642e..161e2f7 100644
--- a/tests/daemon/mgmt/fib-manager.t.cpp
+++ b/tests/daemon/mgmt/fib-manager.t.cpp
@@ -22,11 +22,13 @@
* You should have received a copy of the GNU General Public License along with
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "mgmt/fib-manager.hpp"
+#include "table/fib-nexthop.hpp"
#include "nfd-manager-common-fixture.hpp"
-#include "table/fib-nexthop.hpp"
#include "../face/dummy-face.hpp"
+
#include <ndn-cxx/lp/tags.hpp>
#include <ndn-cxx/mgmt/nfd/fib-entry.hpp>
@@ -107,16 +109,16 @@
}
if (faceId != face::FACEID_NULL) {
- for (auto&& record : nextHops) {
+ for (const auto& record : nextHops) {
if (record.getFace().getId() == faceId) {
- return expectedCost != -1 && record.getCost() != static_cast<uint32_t>(expectedCost) ?
- CheckNextHopResult::WRONG_COST : CheckNextHopResult::OK;
+ if (expectedCost != -1 && record.getCost() != static_cast<uint32_t>(expectedCost))
+ return CheckNextHopResult::WRONG_COST;
+ else
+ return CheckNextHopResult::OK;
}
}
-
return CheckNextHopResult::NO_NEXTHOP;
}
-
return CheckNextHopResult::OK;
}
@@ -152,8 +154,8 @@
return os;
}
-BOOST_FIXTURE_TEST_SUITE(Mgmt, FibManagerFixture)
-BOOST_AUTO_TEST_SUITE(TestFibManager)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_FIXTURE_TEST_SUITE(TestFibManager, FibManagerFixture)
BOOST_AUTO_TEST_SUITE(AddNextHop)
@@ -389,6 +391,8 @@
BOOST_AUTO_TEST_SUITE_END() // RemoveNextHop
+BOOST_AUTO_TEST_SUITE(List)
+
// @todo Remove when ndn::nfd::FibEntry implements operator!= and operator<<
class FibEntry : public ndn::nfd::FibEntry
{
@@ -408,17 +412,17 @@
return true;
}
- auto leftNextHops = left.getNextHopRecords();
- auto rightNextHops = right.getNextHopRecords();
+ const auto& leftNextHops = left.getNextHopRecords();
+ const auto& rightNextHops = right.getNextHopRecords();
if (leftNextHops.size() != rightNextHops.size()) {
return true;
}
- for (auto&& nexthop : leftNextHops) {
- auto hitEntry =
- std::find_if(rightNextHops.begin(), rightNextHops.end(), [&] (const ndn::nfd::NextHopRecord& record) {
- return nexthop.getCost() == record.getCost() && nexthop.getFaceId() == record.getFaceId();
- });
+ for (const auto& nexthop : leftNextHops) {
+ auto hitEntry = std::find_if(rightNextHops.begin(), rightNextHops.end(),
+ [&] (const ndn::nfd::NextHopRecord& record) {
+ return nexthop.getCost() == record.getCost() && nexthop.getFaceId() == record.getFaceId();
+ });
if (hitEntry == rightNextHops.end()) {
return true;
@@ -476,7 +480,7 @@
FibEntry record;
record.setPrefix(matchedEntry->getPrefix());
const auto& nextHops = matchedEntry->getNextHops();
- for (auto&& next : nextHops) {
+ for (const auto& next : nextHops) {
ndn::nfd::NextHopRecord nextHopRecord;
nextHopRecord.setFaceId(next.getFace().getId());
nextHopRecord.setCost(next.getCost());
@@ -486,11 +490,12 @@
}
BOOST_CHECK_EQUAL(actualPrefixes.size(), 0);
-
BOOST_CHECK_EQUAL_COLLECTIONS(receivedRecords.begin(), receivedRecords.end(),
expectedRecords.begin(), expectedRecords.end());
}
+BOOST_AUTO_TEST_SUITE_END() // List
+
BOOST_AUTO_TEST_SUITE_END() // TestFibManager
BOOST_AUTO_TEST_SUITE_END() // Mgmt
diff --git a/tests/daemon/mgmt/forwarder-status-manager.t.cpp b/tests/daemon/mgmt/forwarder-status-manager.t.cpp
index ec73af1..b9cade3 100644
--- a/tests/daemon/mgmt/forwarder-status-manager.t.cpp
+++ b/tests/daemon/mgmt/forwarder-status-manager.t.cpp
@@ -31,8 +31,6 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(Mgmt)
-
class ForwarderStatusManagerFixture : public NfdManagerCommonFixture
{
protected:
@@ -48,9 +46,10 @@
time::system_clock::TimePoint startTime;
};
+BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_FIXTURE_TEST_SUITE(TestForwarderStatusManager, ForwarderStatusManagerFixture)
-BOOST_AUTO_TEST_CASE(GeneralStatus)
+BOOST_AUTO_TEST_CASE(GeneralStatusDataset)
{
// cause counters to be non-zero
this->advanceClocks(time::seconds(3600));
diff --git a/tests/daemon/mgmt/nfd-manager-common-fixture.hpp b/tests/daemon/mgmt/nfd-manager-common-fixture.hpp
index 65c5dcc..fb2dbc2 100644
--- a/tests/daemon/mgmt/nfd-manager-common-fixture.hpp
+++ b/tests/daemon/mgmt/nfd-manager-common-fixture.hpp
@@ -23,10 +23,10 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NFD_TESTS_NFD_MGMT_NFD_MANAGER_COMMON_FIXTURE_HPP
-#define NFD_TESTS_NFD_MGMT_NFD_MANAGER_COMMON_FIXTURE_HPP
+#ifndef NFD_TESTS_DAEMON_MGMT_NFD_MANAGER_COMMON_FIXTURE_HPP
+#define NFD_TESTS_DAEMON_MGMT_NFD_MANAGER_COMMON_FIXTURE_HPP
-#include "manager-common-fixture.hpp"
+#include "tests/manager-common-fixture.hpp"
#include "fw/forwarder.hpp"
#include "mgmt/command-authenticator.hpp"
@@ -58,7 +58,7 @@
class CommandSuccess
{
public:
- ControlResponse
+ static ControlResponse
getExpected()
{
return ControlResponse()
@@ -71,7 +71,7 @@
class CommandFailure
{
public:
- ControlResponse
+ static ControlResponse
getExpected()
{
return ControlResponse()
@@ -83,4 +83,4 @@
} // namespace tests
} // namespace nfd
-#endif // NFD_TESTS_NFD_MGMT_NFD_MANAGER_COMMON_FIXTURE_HPP
+#endif // NFD_TESTS_DAEMON_MGMT_NFD_MANAGER_COMMON_FIXTURE_HPP
diff --git a/tests/daemon/mgmt/strategy-choice-manager.t.cpp b/tests/daemon/mgmt/strategy-choice-manager.t.cpp
index 1d8e135..56f22a7 100644
--- a/tests/daemon/mgmt/strategy-choice-manager.t.cpp
+++ b/tests/daemon/mgmt/strategy-choice-manager.t.cpp
@@ -24,14 +24,14 @@
*/
#include "mgmt/strategy-choice-manager.hpp"
-#include "nfd-manager-common-fixture.hpp"
#include "face/face.hpp"
#include "face/internal-face.hpp"
+#include "fw/strategy.hpp"
#include "table/name-tree.hpp"
#include "table/strategy-choice.hpp"
-#include "fw/strategy.hpp"
+#include "nfd-manager-common-fixture.hpp"
#include "tests/daemon/face/dummy-face.hpp"
#include "tests/daemon/fw/dummy-strategy.hpp"
#include "tests/daemon/fw/install-strategy.hpp"
@@ -77,8 +77,8 @@
StrategyChoiceManager m_manager;
};
-BOOST_FIXTURE_TEST_SUITE(Mgmt, StrategyChoiceManagerFixture)
-BOOST_AUTO_TEST_SUITE(TestStrategyChoiceManager)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_FIXTURE_TEST_SUITE(TestStrategyChoiceManager, StrategyChoiceManagerFixture)
BOOST_AUTO_TEST_CASE(SetStrategy)
{
@@ -191,11 +191,11 @@
return os;
}
-BOOST_AUTO_TEST_CASE(ListChoices)
+BOOST_AUTO_TEST_CASE(StrategyChoiceDataset)
{
size_t nPreInsertedStrategies = m_strategyChoice.size(); // the best-route strategy
std::set<Name> actualNames, actualStrategies;
- for (auto&& entry : m_strategyChoice) {
+ for (const auto& entry : m_strategyChoice) {
actualNames.insert(entry.getPrefix());
actualStrategies.insert(entry.getStrategyName());
}
@@ -239,7 +239,6 @@
BOOST_CHECK_EQUAL(actualNames.size(), 0);
BOOST_CHECK_EQUAL(actualStrategies.size(), 0);
-
BOOST_CHECK_EQUAL_COLLECTIONS(receivedRecords.begin(), receivedRecords.end(),
expectedRecords.begin(), expectedRecords.end());
}
diff --git a/tests/daemon/table/cs-policy-lru.t.cpp b/tests/daemon/table/cs-policy-lru.t.cpp
index a4e76a8..71f1764 100644
--- a/tests/daemon/table/cs-policy-lru.t.cpp
+++ b/tests/daemon/table/cs-policy-lru.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -35,9 +35,10 @@
using namespace nfd::tests;
-BOOST_AUTO_TEST_SUITE(CsLru)
+BOOST_AUTO_TEST_SUITE(Table)
+BOOST_AUTO_TEST_SUITE(TestCsLru)
-BOOST_FIXTURE_TEST_CASE(EvictOneLRU, UnitTestTimeFixture)
+BOOST_FIXTURE_TEST_CASE(EvictOne, UnitTestTimeFixture)
{
Cs cs(3);
cs.setPolicy(make_unique<LruPolicy>());
@@ -84,7 +85,8 @@
bind([] { BOOST_CHECK(true); }));
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestCsLru
+BOOST_AUTO_TEST_SUITE_END() // Table
} // namespace tests
} // namespace cs
diff --git a/tests/daemon/table/cs-policy-priority-fifo.t.cpp b/tests/daemon/table/cs-policy-priority-fifo.t.cpp
index 8f365d4..01380ef 100644
--- a/tests/daemon/table/cs-policy-priority-fifo.t.cpp
+++ b/tests/daemon/table/cs-policy-priority-fifo.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -35,7 +35,8 @@
using namespace nfd::tests;
-BOOST_AUTO_TEST_SUITE(CsPriorityFifo)
+BOOST_AUTO_TEST_SUITE(Table)
+BOOST_AUTO_TEST_SUITE(TestCsPriorityFifo)
BOOST_FIXTURE_TEST_CASE(EvictOne, UnitTestTimeFixture)
{
@@ -140,7 +141,8 @@
bind([] { BOOST_CHECK(true); }));
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestCsPriorityFifo
+BOOST_AUTO_TEST_SUITE_END() // Table
} // namespace tests
} // namespace cs