tests: improve test coverage of FaceManager
And misc cleanups in various mgmt test suites.
Refs: #3377
Change-Id: I189f8891559dae6e2329338e7707991ca476db0e
diff --git a/tests/daemon/mgmt/rib-manager.t.cpp b/tests/daemon/mgmt/rib-manager.t.cpp
index 2e876d5..6da89d3 100644
--- a/tests/daemon/mgmt/rib-manager.t.cpp
+++ b/tests/daemon/mgmt/rib-manager.t.cpp
@@ -186,11 +186,8 @@
auto replyFibAddCommand = [this] (const Interest& interest) {
ControlParameters params(interest.getName().at(4).blockFromValue());
BOOST_CHECK(params.getName() == "/localhost/nfd/rib" || params.getName() == "/localhop/nfd/rib");
- params.setFaceId(1)
- .setCost(0);
- ControlResponse resp;
- resp.setCode(200)
- .setBody(params.wireEncode());
+ params.setFaceId(1).setCost(0);
+ ControlResponse resp = makeResponse(200, "OK", params);
auto data = make_shared<Data>(interest.getName());
data->setContent(resp.wireEncode());
@@ -603,8 +600,8 @@
BOOST_REQUIRE_EQUAL(content.elements().size(), nEntries);
std::vector<ndn::nfd::RibEntry> receivedRecords, expectedRecords;
- for (size_t idx = 0; idx < nEntries; ++idx) {
- ndn::nfd::RibEntry decodedEntry(content.elements()[idx]);
+ for (const auto& el : content.elements()) {
+ ndn::nfd::RibEntry decodedEntry(el);
BOOST_TEST_INFO_SCOPE(decodedEntry);
receivedRecords.push_back(decodedEntry);
actualPrefixes.erase(decodedEntry.getName());
@@ -613,7 +610,7 @@
BOOST_REQUIRE(matchedEntryIt != m_rib.end());
auto matchedEntry = matchedEntryIt->second;
- BOOST_REQUIRE(matchedEntry != nullptr);
+ BOOST_TEST_REQUIRE(matchedEntry != nullptr);
expectedRecords.emplace_back();
expectedRecords.back().setName(matchedEntry->getName());
@@ -664,8 +661,8 @@
auto it2 = m_rib.find("/test-remove-invalid-faces-2");
BOOST_CHECK(it2 == m_rib.end());
BOOST_REQUIRE(it1 != m_rib.end());
- BOOST_CHECK(it1->second->hasFaceId(1));
- BOOST_CHECK(!it1->second->hasFaceId(2));
+ BOOST_TEST(it1->second->hasFaceId(1));
+ BOOST_TEST(!it1->second->hasFaceId(2));
}
BOOST_AUTO_TEST_CASE(OnNotification)