Skip to content

Commit

Permalink
tests: code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pesa committed Dec 3, 2023
1 parent fe0a337 commit 3282ce2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 28 deletions.
31 changes: 13 additions & 18 deletions tests/unit-tests/core.t.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2021 University of California, Los Angeles
* Copyright (c) 2012-2023 University of California, Los Angeles
*
* This file is part of ndn-svs, synchronization library for distributed realtime
* applications for NDN.
Expand All @@ -18,31 +18,28 @@

#include "tests/boost-test.hpp"

namespace ndn {
namespace svs {
namespace test {
namespace ndn::tests {

struct TestCoreFixture
using namespace ndn::svs;

class CoreFixture
{
TestCoreFixture()
protected:
CoreFixture()
: m_syncPrefix("/ndn/test")
, m_core(m_face, m_syncPrefix, std::bind(&TestCoreFixture::update, this, _1))
, m_core(m_face, m_syncPrefix, [] (auto&&...) {})
{
}

protected:
Face m_face;
Name m_syncPrefix;
SVSyncCore m_core;

void
update(const std::vector<MissingDataInfo>& v)
{
}
};

BOOST_FIXTURE_TEST_SUITE(TestCore, TestCoreFixture)
BOOST_FIXTURE_TEST_SUITE(TestCore, CoreFixture)

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

Expand Down Expand Up @@ -74,14 +71,12 @@ BOOST_AUTO_TEST_CASE(mergeStateVector)
BOOST_CHECK_EQUAL(v.get("two"), 2);
BOOST_CHECK_EQUAL(v.get("three"), 3);

BOOST_CHECK_EQUAL(missingData.size(), 1);
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_AUTO_TEST_SUITE_END()

} // namespace ndn
} // namespace ndn
} // namespace ndn
} // namespace ndn::tests
19 changes: 9 additions & 10 deletions tests/unit-tests/version-vector.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,24 @@

#include "tests/boost-test.hpp"

namespace ndn {
namespace svs {
namespace test {
namespace ndn::tests {

class TestVersionVectorFixture
using namespace ndn::svs;

class VersionVectorFixture
{
protected:
TestVersionVectorFixture()
VersionVectorFixture()
{
v.set("one", 1);
v.set("two", 2);
}

protected:
VersionVector v;
};

BOOST_FIXTURE_TEST_SUITE(TestVersionVector, TestVersionVectorFixture)
BOOST_FIXTURE_TEST_SUITE(TestVersionVector, VersionVectorFixture)

BOOST_AUTO_TEST_CASE(Get)
{
Expand Down Expand Up @@ -78,7 +79,7 @@ BOOST_AUTO_TEST_CASE(DecodeStatic)
// Hex: CA0A070508036F6E65CC0101CA0A0705080374776FCC0102
constexpr std::string_view encoded{"\xCA\x0A\x07\x05\x08\x03\x6F\x6E\x65\xCC\x01\x01"
"\xCA\x0A\x07\x05\x08\x03\x74\x77\x6F\xCC\x01\x02"};
VersionVector dv(ndn::encoding::makeStringBlock(tlv::StateVector, encoded));
VersionVector dv(ndn::encoding::makeStringBlock(svs::tlv::StateVector, encoded));
BOOST_CHECK_EQUAL(dv.get("one"), 1);
BOOST_CHECK_EQUAL(dv.get("two"), 2);
}
Expand All @@ -103,6 +104,4 @@ BOOST_AUTO_TEST_CASE(Ordering)

BOOST_AUTO_TEST_SUITE_END()

} // namespace ndn
} // namespace ndn
} // namespace ndn
} // namespace ndn::tests

0 comments on commit 3282ce2

Please sign in to comment.