sync: improved unit tests
refs: #4264
Change-Id: I981f3d8f653e4750ee6f9d77f2c89188f11d8ebb
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index 4de69ef..789edf6 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -68,23 +68,8 @@
, m_sync(m_nlsr.getNlsrFace(),
[this] (const ndn::Name& routerName, const std::string& lsaType,
const uint64_t& sequenceNumber) {
- ndn::Name lsaKey = routerName;
- lsaKey.append(lsaType);
-
- if (lsaType == NameLsa::TYPE_STRING) {
- return isNameLsaNew(lsaKey, sequenceNumber);
- }
- else if (lsaType == AdjLsa::TYPE_STRING) {
- return isAdjLsaNew(lsaKey, sequenceNumber);
- }
- else if (lsaType == CoordinateLsa::TYPE_STRING) {
- return isCoordinateLsaNew(lsaKey, sequenceNumber);
- }
- else {
- return false;
- }
- },
- m_nlsr.getConfParameter())
+ return isLsaNew(routerName, lsaType, sequenceNumber);
+ }, m_nlsr.getConfParameter())
, m_lsaRefreshTime(0)
, m_adjLsaBuildInterval(ADJ_LSA_BUILD_INTERVAL_DEFAULT)
, m_sequencingManager()
@@ -1313,4 +1298,24 @@
return false;
}
+bool
+Lsdb::isLsaNew(const ndn::Name& routerName, const std::string& lsaType,
+ const uint64_t& sequenceNumber) {
+ ndn::Name lsaKey = routerName;
+ lsaKey.append(lsaType);
+
+ if (lsaType == NameLsa::TYPE_STRING) {
+ return isNameLsaNew(lsaKey, sequenceNumber);
+ }
+ else if (lsaType == AdjLsa::TYPE_STRING) {
+ return isAdjLsaNew(lsaKey, sequenceNumber);
+ }
+ else if (lsaType == CoordinateLsa::TYPE_STRING) {
+ return isCoordinateLsaNew(lsaKey, sequenceNumber);
+ }
+ else {
+ return false;
+ }
+}
+
} // namespace nlsr