style: made container APIs more consistent.
Change-Id: Ib4feedfc4c9fb497dfcd67e7e6a33ee03db58d7f
refs: #4337
diff --git a/tests/test-adjacency-list.cpp b/tests/test-adjacency-list.cpp
index 465fd9a..1488daa 100644
--- a/tests/test-adjacency-list.cpp
+++ b/tests/test-adjacency-list.cpp
@@ -19,9 +19,8 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
-#include "common.hpp"
-
#include "adjacency-list.hpp"
+#include "common.hpp"
#include "adjacent.hpp"
#include "conf-parameter.hpp"
@@ -50,7 +49,7 @@
adjacentList1.insert(adjacent1);
adjacentList2.insert(adjacent2);
- BOOST_CHECK_EQUAL(adjacentList1.getSize(), (uint32_t)1);
+ BOOST_CHECK_EQUAL(adjacentList1.size(), (uint32_t)1);
BOOST_CHECK_EQUAL(adjacentList1 == adjacentList2, false);
BOOST_CHECK(adjacentList1.isNeighbor("testname"));
diff --git a/tests/test-conf-file-processor.cpp b/tests/test-conf-file-processor.cpp
index df347f1..abcaefb 100644
--- a/tests/test-conf-file-processor.cpp
+++ b/tests/test-conf-file-processor.cpp
@@ -19,17 +19,15 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
+#include "conf-file-processor.hpp"
#include "test-common.hpp"
#include "logger.hpp"
-
-#include <fstream>
-#include "conf-file-processor.hpp"
#include "nlsr.hpp"
+#include <fstream>
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
-
#include <ndn-cxx/util/dummy-client-face.hpp>
namespace nlsr {
@@ -271,7 +269,7 @@
BOOST_CHECK_EQUAL(conf.getRoutingCalcInterval(), 9);
// Advertising
- BOOST_CHECK_EQUAL(nlsr.getNamePrefixList().getSize(), 2);
+ BOOST_CHECK_EQUAL(nlsr.getNamePrefixList().size(), 2);
}
BOOST_AUTO_TEST_CASE(Log4cxxFileExists)
diff --git a/tests/test-lsa.cpp b/tests/test-lsa.cpp
index e501c59..2750bb4 100644
--- a/tests/test-lsa.cpp
+++ b/tests/test-lsa.cpp
@@ -19,14 +19,12 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
-#include "test-common.hpp"
-
-#include "adjacent.hpp"
#include "lsa.hpp"
+#include "test-common.hpp"
+#include "adjacent.hpp"
#include "name-prefix-list.hpp"
#include <ndn-cxx/util/time.hpp>
-
#include <sstream>
namespace nlsr {
@@ -70,8 +68,8 @@
activeAdjacencies.insert(activeAdjacency);
AdjLsa alsa1(routerName, seqNo, testTimePoint,
- activeAdjacencies.getSize(), activeAdjacencies);
- BOOST_CHECK_EQUAL(alsa1.getAdl().getSize(), 1);
+ activeAdjacencies.size(), activeAdjacencies);
+ BOOST_CHECK_EQUAL(alsa1.getAdl().size(), 1);
BOOST_CHECK_EQUAL(alsa1.getLsType(), AdjLsa::TYPE_STRING);
BOOST_CHECK_EQUAL(alsa1.getLsSeqNo(), seqNo);
BOOST_CHECK_EQUAL(alsa1.getExpirationTimePoint(), testTimePoint);
@@ -85,15 +83,15 @@
inactiveAdjacencies.insert(inactiveAdjacency);
AdjLsa alsa2(routerName, seqNo, testTimePoint,
- inactiveAdjacencies.getSize(), inactiveAdjacencies);
- BOOST_CHECK_EQUAL(alsa2.getAdl().getSize(), 0);
+ inactiveAdjacencies.size(), inactiveAdjacencies);
+ BOOST_CHECK_EQUAL(alsa2.getAdl().size(), 0);
// Thus, the two LSAs should not have equal content
BOOST_CHECK_EQUAL(alsa1.isEqualContent(alsa2), false);
// Create a duplicate of alsa1 which should have equal content
AdjLsa alsa3(routerName, seqNo, testTimePoint,
- activeAdjacencies.getSize(), activeAdjacencies);
+ activeAdjacencies.size(), activeAdjacencies);
BOOST_CHECK(alsa1.isEqualContent(alsa3));
}
@@ -132,7 +130,7 @@
const std::string TEST_TIME_POINT_STRING = ss.str();
- AdjLsa lsa("router1", 12, testTimePoint, adjList.getSize(), adjList);
+ AdjLsa lsa("router1", 12, testTimePoint, adjList.size(), adjList);
std::string EXPECTED_OUTPUT =
"Adj Lsa:\n"
@@ -178,7 +176,7 @@
ndn::time::system_clock::TimePoint testTimePoint = ndn::time::system_clock::now();
- AdjLsa adjlsa1("router1", 1, testTimePoint, adjList.getSize(), adjList);
+ AdjLsa adjlsa1("router1", 1, testTimePoint, adjList.size(), adjList);
AdjLsa adjlsa2;
BOOST_CHECK(adjlsa2.initializeFromContent(adjlsa1.getData()));
diff --git a/tests/test-name-prefix-list.cpp b/tests/test-name-prefix-list.cpp
index eef0c18..080b259 100644
--- a/tests/test-name-prefix-list.cpp
+++ b/tests/test-name-prefix-list.cpp
@@ -39,11 +39,11 @@
npl1.insert(a);
npl1.insert(b);
- BOOST_CHECK_EQUAL(npl1.getSize(), 2);
+ BOOST_CHECK_EQUAL(npl1.size(), 2);
npl1.remove(b);
- BOOST_CHECK_EQUAL(npl1.getSize(), 1);
+ BOOST_CHECK_EQUAL(npl1.size(), 1);
}
/*
diff --git a/tests/test-name-prefix-table.cpp b/tests/test-name-prefix-table.cpp
index 197cd98..474585c 100644
--- a/tests/test-name-prefix-table.cpp
+++ b/tests/test-name-prefix-table.cpp
@@ -298,7 +298,7 @@
auto iterator = namePrefixTable.m_rtpool.find(destination);
BOOST_REQUIRE(iterator != namePrefixTable.m_rtpool.end());
auto nextHops = (iterator->second)->getNexthopList();
- BOOST_CHECK_EQUAL(nextHops.getSize(), 2);
+ BOOST_CHECK_EQUAL(nextHops.size(), 2);
// Add the other NextHop
routingTable.addNextHop(destination, hop3);
@@ -313,7 +313,7 @@
iterator = namePrefixTable.m_rtpool.find(destination);
BOOST_REQUIRE(iterator != namePrefixTable.m_rtpool.end());
nextHops = (iterator->second)->getNexthopList();
- BOOST_CHECK_EQUAL(nextHops.getSize(), 3);
+ BOOST_CHECK_EQUAL(nextHops.size(), 3);
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/test-nexthop-list.cpp b/tests/test-nexthop-list.cpp
index ce042c7..7d0c16d 100644
--- a/tests/test-nexthop-list.cpp
+++ b/tests/test-nexthop-list.cpp
@@ -36,10 +36,10 @@
NexthopList nhl1;
nhl1.addNextHop(np1);
- BOOST_CHECK_EQUAL(nhl1.getSize(), (uint32_t)1);
+ BOOST_CHECK_EQUAL(nhl1.size(), (uint32_t)1);
nhl1.removeNextHop(np1);
- BOOST_CHECK_EQUAL(nhl1.getSize(), (uint32_t)0);
+ BOOST_CHECK_EQUAL(nhl1.size(), (uint32_t)0);
}
BOOST_AUTO_TEST_CASE(LinkStateRemoveNextHop)
@@ -53,13 +53,13 @@
NextHop hop2;
hop2.setRouteCost(13.01);
- BOOST_REQUIRE_EQUAL(hopList.getSize(), 1);
+ BOOST_REQUIRE_EQUAL(hopList.size(), 1);
hopList.removeNextHop(hop2);
- BOOST_CHECK_EQUAL(hopList.getSize(), 1);
+ BOOST_CHECK_EQUAL(hopList.size(), 1);
hopList.removeNextHop(hop1);
- BOOST_CHECK_EQUAL(hopList.getSize(), 0);
+ BOOST_CHECK_EQUAL(hopList.size(), 0);
}
BOOST_AUTO_TEST_CASE(HyperbolicRemoveNextHop)
@@ -75,13 +75,13 @@
hop2.setHyperbolic(true);
hop2.setRouteCost(12.35);
- BOOST_REQUIRE_EQUAL(hopList.getSize(), 1);
+ BOOST_REQUIRE_EQUAL(hopList.size(), 1);
hopList.removeNextHop(hop2);
- BOOST_CHECK_EQUAL(hopList.getSize(), 1);
+ BOOST_CHECK_EQUAL(hopList.size(), 1);
hopList.removeNextHop(hop1);
- BOOST_CHECK_EQUAL(hopList.getSize(), 0);
+ BOOST_CHECK_EQUAL(hopList.size(), 0);
}
BOOST_AUTO_TEST_CASE(TieBreaker)
@@ -139,7 +139,7 @@
list.addNextHop(hopB);
list.addNextHop(hopC);
- BOOST_REQUIRE_EQUAL(list.getSize(), 3);
+ BOOST_REQUIRE_EQUAL(list.size(), 3);
double lastCost = 0;
for (const auto& hop : list) {
@@ -150,7 +150,7 @@
// removing a hop keep the list sorted
list.removeNextHop(hopA);
- BOOST_REQUIRE_EQUAL(list.getSize(), 2);
+ BOOST_REQUIRE_EQUAL(list.size(), 2);
lastCost = 0;
for (const auto& hop : list) {
@@ -174,7 +174,7 @@
list.addNextHop(hopA);
list.addNextHop(hopB);
- BOOST_REQUIRE_EQUAL(list.getSize(), 1);
+ BOOST_REQUIRE_EQUAL(list.size(), 1);
for (const auto& hop : list) {
BOOST_CHECK_EQUAL(hop, hopB);
diff --git a/tests/test-nlsr.cpp b/tests/test-nlsr.cpp
index 0159cf4..48cd7bf 100644
--- a/tests/test-nlsr.cpp
+++ b/tests/test-nlsr.cpp
@@ -283,7 +283,7 @@
// Make sure the routing table was calculated
RoutingTableEntry* rtEntry = nlsr.getRoutingTable().findRoutingTableEntry(failNeighbor.getName());
BOOST_REQUIRE(rtEntry != nullptr);
- BOOST_REQUIRE_EQUAL(rtEntry->getNexthopList().getSize(), 1);
+ BOOST_REQUIRE_EQUAL(rtEntry->getNexthopList().size(), 1);
// Receive FaceEventDestroyed notification
ndn::nfd::FaceEventNotification event;
@@ -394,7 +394,7 @@
// Adjacency LSA should be built even though other router is INACTIVE
AdjLsa* lsa = lsdb.findAdjLsa(lsaKey);
BOOST_REQUIRE(lsa != nullptr);
- BOOST_CHECK_EQUAL(lsa->getAdl().getSize(), 1);
+ BOOST_CHECK_EQUAL(lsa->getAdl().size(), 1);
// Receive HELLO response from Router B
receiveHelloData(neighborBName, conf.getRouterPrefix());
@@ -420,7 +420,7 @@
// Adjacency LSA should be built
lsa = lsdb.findAdjLsa(lsaKey);
BOOST_REQUIRE(lsa != nullptr);
- BOOST_CHECK_EQUAL(lsa->getAdl().getSize(), 2);
+ BOOST_CHECK_EQUAL(lsa->getAdl().size(), 2);
}
BOOST_AUTO_TEST_CASE(CanonizeUris)
diff --git a/tests/update/test-prefix-update-processor.cpp b/tests/update/test-prefix-update-processor.cpp
index 42d9fa0..8fb4c27 100644
--- a/tests/update/test-prefix-update-processor.cpp
+++ b/tests/update/test-prefix-update-processor.cpp
@@ -252,7 +252,7 @@
NamePrefixList& namePrefixList = nlsr.getNamePrefixList();
- BOOST_REQUIRE_EQUAL(namePrefixList.getSize(), 1);
+ BOOST_REQUIRE_EQUAL(namePrefixList.size(), 1);
BOOST_CHECK_EQUAL(namePrefixList.getNames().front(), parameters.getName());
BOOST_CHECK(wasRoutingUpdatePublished());
@@ -271,7 +271,7 @@
face.receive(*withdrawInterest);
this->advanceClocks(ndn::time::milliseconds(10));
- BOOST_CHECK_EQUAL(namePrefixList.getSize(), 0);
+ BOOST_CHECK_EQUAL(namePrefixList.size(), 0);
BOOST_CHECK(wasRoutingUpdatePublished());
BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.getLsdb().getSequencingManager().getNameLsaSeq());