src: Correct bitmask used to copy Name LSA SeqNo
refs: #2323
Change-Id: Ie67513b6228039538666e218f0c9c868ec0c1af8
diff --git a/src/sequencing-manager.cpp b/src/sequencing-manager.cpp
index d0f4d04..7749ae0 100644
--- a/src/sequencing-manager.cpp
+++ b/src/sequencing-manager.cpp
@@ -36,12 +36,12 @@
using namespace std;
void
-SequencingManager::splittSequenceNo(uint64_t seqNo)
+SequencingManager::splitSequenceNo(uint64_t seqNo)
{
m_combinedSeqNo = seqNo;
m_adjLsaSeq = (m_combinedSeqNo & 0xFFFFF);
m_corLsaSeq = ((m_combinedSeqNo >> 20) & 0xFFFFF);
- m_nameLsaSeq = ((m_combinedSeqNo >> 40) & 0xFFFFF);
+ m_nameLsaSeq = ((m_combinedSeqNo >> 40) & 0xFFFFFF);
}
void
@@ -68,7 +68,7 @@
std::ifstream inputFile(m_seqFileNameWithPath.c_str(), ios::binary);
if (inputFile.good()) {
inputFile >> m_combinedSeqNo;
- splittSequenceNo(m_combinedSeqNo);
+ splitSequenceNo(m_combinedSeqNo);
m_adjLsaSeq += 10;
m_corLsaSeq += 10;
m_nameLsaSeq += 10;
@@ -76,7 +76,7 @@
inputFile.close();
}
else {
- splittSequenceNo(0);
+ splitSequenceNo(0);
}
}
diff --git a/src/sequencing-manager.hpp b/src/sequencing-manager.hpp
index d6dba91..c023b38 100644
--- a/src/sequencing-manager.hpp
+++ b/src/sequencing-manager.hpp
@@ -43,7 +43,7 @@
SequencingManager(uint64_t seqNo)
{
- splittSequenceNo(seqNo);
+ splitSequenceNo(seqNo);
}
SequencingManager(uint64_t nlsn, uint64_t alsn, uint64_t clsn)
@@ -137,7 +137,7 @@
private:
void
- splittSequenceNo(uint64_t seqNo);
+ splitSequenceNo(uint64_t seqNo);
void
combineSequenceNo();
diff --git a/tests/test-sequencing-manager.cpp b/tests/test-sequencing-manager.cpp
index e6fbde3..7cbb9db 100644
--- a/tests/test-sequencing-manager.cpp
+++ b/tests/test-sequencing-manager.cpp
@@ -1,7 +1,8 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014 University of Memphis,
- * Regents of the University of California
+ * Copyright (c) 2014-2015, The University of Memphis,
+ * Regents of the University of California,
+ * Arizona Board of Regents.
*
* This file is part of NLSR (Named-data Link State Routing).
* See AUTHORS.md for complete list of NLSR authors and contributors.
@@ -16,10 +17,8 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- *
- * \author Ashlesh Gawande <agawande@memphis.edu>
- *
**/
+
#include "sequencing-manager.hpp"
#include <boost/test/unit_test.hpp>
@@ -42,6 +41,20 @@
BOOST_CHECK_EQUAL(sm2.getCorLsaSeq(), (uint32_t)122);
}
+BOOST_AUTO_TEST_CASE(BitMask)
+{
+ uint64_t nameLsaSeqNoMax = 0xFFFFFF;
+ uint64_t corLsaSeqNoMax = 0xFFFFF;
+ uint64_t adjLsaSeqNoMax = 0xFFFFF;
+
+ uint64_t seqNo = (nameLsaSeqNoMax << 40) | (corLsaSeqNoMax << 20) | adjLsaSeqNoMax;
+ SequencingManager manager(seqNo);
+
+ BOOST_CHECK_EQUAL(manager.getNameLsaSeq(), nameLsaSeqNoMax);
+ BOOST_CHECK_EQUAL(manager.getCorLsaSeq(), corLsaSeqNoMax);
+ BOOST_CHECK_EQUAL(manager.getAdjLsaSeq(), adjLsaSeqNoMax);
+}
+
BOOST_AUTO_TEST_SUITE_END()
} //namespace test