src: decouple classes from Nlsr object
refs: #1952, #2803, #3960, #4288
Change-Id: Ibe3ac3820f11e8107ee4b13e510d53c27467a6cb
diff --git a/tests/test-sequencing-manager.cpp b/tests/test-sequencing-manager.cpp
index e05597f..d55f18a 100644
--- a/tests/test-sequencing-manager.cpp
+++ b/tests/test-sequencing-manager.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2017, The University of Memphis,
+ * Copyright (c) 2014-2019, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -19,8 +19,8 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
-#include "test-common.hpp"
#include "sequencing-manager.hpp"
+#include "test-common.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
#include <string>
@@ -37,10 +37,8 @@
{
public:
SequencingManagerFixture()
- : m_seqNumbers("")
- , m_seqManager()
+ : m_seqManager("/tmp", HYPERBOLIC_STATE_OFF)
{
- setFileDir();
}
~SequencingManagerFixture()
@@ -49,11 +47,6 @@
}
void
- setFileDir() {
- m_seqManager.setSeqFileDirectory("/tmp");
- }
-
- void
writeToFile(const std::string& testSeq) {
std::ofstream outputFile(seqFile, std::ofstream::trunc);
outputFile << testSeq;
@@ -61,8 +54,8 @@
}
void
- initiateFromFile(const int& type) {
- m_seqManager.initiateSeqNoFromFile(type);
+ initiateFromFile() {
+ m_seqManager.initiateSeqNoFromFile();
}
void
@@ -74,8 +67,7 @@
BOOST_CHECK_EQUAL(m_seqManager.getCorLsaSeq(), cor);
}
-private:
- std::string m_seqNumbers;
+public:
std::string seqFile = "/tmp/nlsrSeqNo.txt";
SequencingManager m_seqManager;
};
@@ -86,16 +78,14 @@
{
// LS
writeToFile("27121653322350672");
-
- initiateFromFile(HYPERBOLIC_STATE_OFF);
-
+ m_seqManager.m_hyperbolicState = HYPERBOLIC_STATE_OFF;
+ initiateFromFile();
checkSeqNumbers(24667+10, 80+10, 0);
// HR
writeToFile("27121653322350672");
-
- initiateFromFile(HYPERBOLIC_STATE_ON);
-
+ m_seqManager.m_hyperbolicState = HYPERBOLIC_STATE_ON;
+ initiateFromFile();
// AdjLsa is set to 0 since HR is on
checkSeqNumbers(24667+10, 0, 0+10);
}
@@ -104,16 +94,14 @@
{
// LS
writeToFile("NameLsaSeq 100\nAdjLsaSeq 100\nCorLsaSeq 0");
-
- initiateFromFile(HYPERBOLIC_STATE_OFF);
-
+ m_seqManager.m_hyperbolicState = HYPERBOLIC_STATE_OFF;
+ initiateFromFile();
checkSeqNumbers(100+10, 100+10, 0);
// HR
writeToFile("NameLsa 100\nAdjLsa 0\nCorLsa 100");
-
- initiateFromFile(HYPERBOLIC_STATE_ON);
-
+ m_seqManager.m_hyperbolicState = HYPERBOLIC_STATE_ON;
+ initiateFromFile();
// AdjLsa is set to 0 since HR is on
checkSeqNumbers(100+10, 0, 100+10);
}