replace hash2prefix/prefix2hash with boost::bimap
refs: #5065
Change-Id: I32f690f0a85d5129c56ac2cfda382facbdaaaa49
diff --git a/tests/test-full-sync.cpp b/tests/test-full-sync.cpp
index d79e012..34bef0c 100644
--- a/tests/test-full-sync.cpp
+++ b/tests/test-full-sync.cpp
@@ -54,7 +54,7 @@
shared_ptr<FullProducer> nodes[4];
};
-BOOST_FIXTURE_TEST_SUITE(FullSync, FullSyncFixture)
+BOOST_FIXTURE_TEST_SUITE(TestFullSync, FullSyncFixture)
BOOST_AUTO_TEST_CASE(TwoNodesSimple)
{
diff --git a/tests/test-partial-sync.cpp b/tests/test-partial-sync.cpp
index 8938483..fae7958 100644
--- a/tests/test-partial-sync.cpp
+++ b/tests/test-partial-sync.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, The University of Memphis
+ * Copyright (c) 2014-2020, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -147,7 +147,7 @@
int numSyncDataRcvd;
};
-BOOST_FIXTURE_TEST_SUITE(PartialSync, PartialSyncFixture)
+BOOST_FIXTURE_TEST_SUITE(TestPartialSync, PartialSyncFixture)
BOOST_AUTO_TEST_CASE(Simple)
{
@@ -430,4 +430,4 @@
BOOST_AUTO_TEST_SUITE_END()
-} // namespace psync
\ No newline at end of file
+} // namespace psync
diff --git a/tests/test-producer-base.cpp b/tests/test-producer-base.cpp
index e775ad8..c5f1112 100644
--- a/tests/test-producer-base.cpp
+++ b/tests/test-producer-base.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, The University of Memphis
+ * Copyright (c) 2014-2020, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -51,18 +51,19 @@
BOOST_CHECK(producerBase.getSeqNo(userNode.toUri()).value() == 1);
std::string prefixWithSeq = Name(userNode).appendNumber(1).toUri();
- uint32_t hash = producerBase.m_prefix2hash[prefixWithSeq];
- BOOST_CHECK_EQUAL(producerBase.m_hash2prefix[hash], userNode.toUri());
+ uint32_t hash = producerBase.m_biMap.right.find(prefixWithSeq)->second;
+ Name prefix(producerBase.m_biMap.left.find(hash)->second);
+ BOOST_CHECK_EQUAL(prefix.getPrefix(-1), userNode);
producerBase.removeUserNode(userNode);
BOOST_CHECK(producerBase.getSeqNo(userNode.toUri()) == ndn::nullopt);
- BOOST_CHECK(producerBase.m_prefix2hash.find(prefixWithSeq) == producerBase.m_prefix2hash.end());
- BOOST_CHECK(producerBase.m_hash2prefix.find(hash) == producerBase.m_hash2prefix.end());
+ BOOST_CHECK(producerBase.m_biMap.right.find(prefixWithSeq) == producerBase.m_biMap.right.end());
+ BOOST_CHECK(producerBase.m_biMap.left.find(hash) == producerBase.m_biMap.left.end());
Name nonExistentUserNode("/notAUser");
producerBase.updateSeqNo(nonExistentUserNode, 1);
- BOOST_CHECK(producerBase.m_prefix2hash.find(Name(nonExistentUserNode).appendNumber(1).toUri()) ==
- producerBase.m_prefix2hash.end());
+ BOOST_CHECK(producerBase.m_biMap.right.find(Name(nonExistentUserNode).appendNumber(1).toUri()) ==
+ producerBase.m_biMap.right.end());
}
BOOST_AUTO_TEST_CASE(ApplicationNack)