Skip to content

Commit

Permalink
tests: fix core test
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsejet committed Jan 6, 2025
1 parent 58c6a91 commit 84e545e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/unit-tests/core.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,40 @@ BOOST_FIXTURE_TEST_SUITE(TestCore, CoreFixture)

BOOST_AUTO_TEST_CASE(MergeStateVector)
{
std::vector<MissingDataInfo> missingData;
std::vector<MissingDataInfo> missingInfo;

VersionVector v = m_core.getState();
BOOST_CHECK_EQUAL(v.get("one"), 0);
BOOST_CHECK_EQUAL(v.get("two"), 0);
BOOST_CHECK_EQUAL(v.get("three"), 0);
BOOST_CHECK_EQUAL(missingData.size(), 0);
BOOST_CHECK_EQUAL(missingInfo.size(), 0);

VersionVector v1;
v1.set("one", 1);
v1.set("two", 2);
missingData = std::get<2>(m_core.mergeStateVector(v1));
missingInfo = m_core.mergeStateVector(v1).missingInfo;

v = m_core.getState();
BOOST_CHECK_EQUAL(v.get("one"), 1);
BOOST_CHECK_EQUAL(v.get("two"), 2);
BOOST_CHECK_EQUAL(v.get("three"), 0);
BOOST_CHECK_EQUAL(missingData.size(), 2);
BOOST_CHECK_EQUAL(missingInfo.size(), 2);

VersionVector v2;
v2.set("one", 1);
v2.set("two", 1);
v2.set("three", 3);
missingData = std::get<2>(m_core.mergeStateVector(v2));
missingInfo = m_core.mergeStateVector(v2).missingInfo;

v = m_core.getState();
BOOST_CHECK_EQUAL(v.get("one"), 1);
BOOST_CHECK_EQUAL(v.get("two"), 2);
BOOST_CHECK_EQUAL(v.get("three"), 3);

BOOST_REQUIRE_EQUAL(missingData.size(), 1);
BOOST_CHECK_EQUAL(missingData[0].nodeId, "three");
BOOST_CHECK_EQUAL(missingData[0].low, 1);
BOOST_CHECK_EQUAL(missingData[0].high, 3);
BOOST_REQUIRE_EQUAL(missingInfo.size(), 1);
BOOST_CHECK_EQUAL(missingInfo[0].nodeId, "three");
BOOST_CHECK_EQUAL(missingInfo[0].low, 1);
BOOST_CHECK_EQUAL(missingInfo[0].high, 3);
}

BOOST_AUTO_TEST_SUITE_END()
Expand Down

0 comments on commit 84e545e

Please sign in to comment.