Avoid deprecated ndn-cxx functions
Also, waf is updated to version 2.0.23
Change-Id: I053d7dce733455ec352931a1614082542ca00570
diff --git a/tests/unit-tests/test-interest-table.cpp b/tests/unit-tests/test-interest-table.cpp
index 9e98c0b..655762e 100644
--- a/tests/unit-tests/test-interest-table.cpp
+++ b/tests/unit-tests/test-interest-table.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2019 University of California, Los Angeles
+ * Copyright (c) 2012-2022 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -32,24 +32,24 @@
public:
InterestTableFixture()
{
- uint8_t origin[4] = {0x01, 0x02, 0x03, 0x04};
+ const uint8_t origin[] = {0x01, 0x02, 0x03, 0x04};
Name prefix("/test/prefix");
Name interestName1;
- digest1 = ndn::util::Sha256::computeDigest(origin, 1);
+ digest1 = ndn::util::Sha256::computeDigest({origin, 1});
interestName1.append(prefix).append(name::Component(digest1));
interest1 = Interest(interestName1);
interest1.setInterestLifetime(time::milliseconds(100));
Name interestName2;
- digest2 = ndn::util::Sha256::computeDigest(origin, 2);
+ digest2 = ndn::util::Sha256::computeDigest({origin, 2});
interestName2.append(prefix).append(name::Component(digest2));
interest2 = Interest(interestName2);
interest2.setInterestLifetime(time::milliseconds(100));
Name interestName3;
- digest3 = ndn::util::Sha256::computeDigest(origin, 3);
+ digest3 = ndn::util::Sha256::computeDigest({origin, 3});
interestName3.append(prefix).append(name::Component(digest3));
interest3 = Interest(interestName3);
interest3.setInterestLifetime(time::milliseconds(100));
diff --git a/tests/unit-tests/test-leaf.cpp b/tests/unit-tests/test-leaf.cpp
index 71ea8f1..bc284b1 100644
--- a/tests/unit-tests/test-leaf.cpp
+++ b/tests/unit-tests/test-leaf.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2019 University of California, Los Angeles
+ * Copyright (c) 2012-2022 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -54,10 +54,7 @@
Name userPrefix("/test/name");
Leaf leaf(userPrefix, 1, 10);
- BOOST_CHECK_NO_THROW(leaf.getDigest());
-
- ndn::ConstBufferPtr digest = leaf.getDigest();
- BOOST_CHECK_EQUAL(result, ndn::toHex(digest->data(), digest->size(), false));
+ BOOST_CHECK_EQUAL(result, ndn::toHex(*leaf.getDigest(), false));
}
BOOST_AUTO_TEST_CASE(Container)
diff --git a/tests/unit-tests/test-logic.cpp b/tests/unit-tests/test-logic.cpp
index 8cb0baf..8459158 100644
--- a/tests/unit-tests/test-logic.cpp
+++ b/tests/unit-tests/test-logic.cpp
@@ -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-2022 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -29,17 +29,11 @@
namespace chronosync {
namespace test {
-using ndn::chronosync::DummyForwarder;
-
class Handler
{
public:
- Handler(ndn::Face& face,
- const Name& syncPrefix,
- const Name& userPrefix)
- : logic(face,
- syncPrefix,
- userPrefix,
+ Handler(ndn::Face& face, const Name& syncPrefix, const Name& userPrefix)
+ : logic(face, syncPrefix, userPrefix,
bind(&Handler::onUpdate, this, _1))
{
}
@@ -87,7 +81,7 @@
Name syncPrefix;
Name userPrefix[4];
- DummyForwarder fw;
+ ndn::chronosync::DummyForwarder fw;
// std::unique_ptr<DummyClientFace> faces[4];
shared_ptr<Handler> handler[4];
@@ -98,7 +92,7 @@
BOOST_FIXTURE_TEST_SUITE(LogicTests, LogicFixture)
static void
-onUpdate(const std::vector<MissingDataInfo>& v)
+onUpdate(const std::vector<MissingDataInfo>&)
{
}
@@ -407,7 +401,7 @@
Logic logic(face, syncPrefix, userPrefix, bind(onUpdate, _1));
State state;
- for (size_t i = 0; i < 50000 && bzip2::compress(reinterpret_cast<const char*>(state.wireEncode().wire()),
+ for (size_t i = 0; i < 50000 && bzip2::compress(reinterpret_cast<const char*>(state.wireEncode().data()),
state.wireEncode().size())->size() < ndn::MAX_NDN_PACKET_SIZE;
i += 10) {
Name prefix("/to/trim");
diff --git a/tests/unit-tests/test-state.cpp b/tests/unit-tests/test-state.cpp
index 850f8da..a302f01 100644
--- a/tests/unit-tests/test-state.cpp
+++ b/tests/unit-tests/test-state.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2019 University of California, Los Angeles
+ * Copyright (c) 2012-2022 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -148,17 +148,16 @@
0x04
};
- Block block(wire, sizeof(wire));
+ Block block(wire);
State state;
BOOST_REQUIRE_NO_THROW(state.wireDecode(block));
BOOST_CHECK_EQUAL(state.getLeaves().size(), 2);
- LeafContainer::index<ordered>::type::iterator it = state.getLeaves().get<ordered>().begin();
+ auto it = state.getLeaves().get<ordered>().begin();
BOOST_CHECK_EQUAL((*it)->getSeq(), 14);
it++;
BOOST_CHECK_EQUAL((*it)->getSeq(), 4);
-
State state2;
Name info1("/test/name");
@@ -169,15 +168,9 @@
info2.appendNumber(1);
state2.update(info2, 4);
- BOOST_REQUIRE_NO_THROW(state2.wireEncode());
Block block2 = state2.wireEncode();
-
- BOOST_CHECK_EQUAL_COLLECTIONS(block.wire(),
- block.wire() + block.size(),
- block2.wire(),
- block2.wire() + block2.size());
-
- BOOST_CHECK(*state.getRootDigest() == *state2.getRootDigest());
+ BOOST_TEST(block == block2, boost::test_tools::per_element());
+ BOOST_TEST(*state.getRootDigest() == *state2.getRootDigest(), boost::test_tools::per_element());
}
BOOST_AUTO_TEST_CASE(Combine)
@@ -208,7 +201,7 @@
BOOST_CHECK_EQUAL(state1.getLeaves().size(), 2);
BOOST_CHECK_EQUAL(state2.getLeaves().size(), 3);
- LeafContainer::index<ordered>::type::iterator it = state2.getLeaves().get<ordered>().begin();
+ auto it = state2.getLeaves().get<ordered>().begin();
BOOST_CHECK_EQUAL((*it)->getSeq(), 4);
it++;
BOOST_CHECK_EQUAL((*it)->getSeq(), 15);