Adapt to ndn-cxx security changes
refs: #4090, #4195, #3828
Change-Id: Ie1bf11d604af12d3b26fba24054ed67fe735ae7c
diff --git a/tests/unit-tests/test-interest-table.cpp b/tests/unit-tests/test-interest-table.cpp
index 8b1f156..0f0c95d 100644
--- a/tests/unit-tests/test-interest-table.cpp
+++ b/tests/unit-tests/test-interest-table.cpp
@@ -18,12 +18,11 @@
*/
#include "interest-table.hpp"
+#include "boost-test.hpp"
+#include "../unit-test-time-fixture.hpp"
#include <unistd.h>
-#include "../unit-test-time-fixture.hpp"
-#include "boost-test.hpp"
-
namespace chronosync {
namespace test {
@@ -36,19 +35,19 @@
Name prefix("/test/prefix");
Name interestName1;
- digest1 = ndn::crypto::computeSha256Digest(origin, 1);
+ digest1 = ndn::util::Sha256::computeDigest(origin, 1);
interestName1.append(prefix).append(name::Component(digest1));
interest1 = make_shared<Interest>(interestName1);
interest1->setInterestLifetime(time::milliseconds(100));
Name interestName2;
- digest2 = ndn::crypto::computeSha256Digest(origin, 2);
+ digest2 = ndn::util::Sha256::computeDigest(origin, 2);
interestName2.append(prefix).append(name::Component(digest2));
interest2 = make_shared<Interest>(interestName2);
interest2->setInterestLifetime(time::milliseconds(100));
Name interestName3;
- digest3 = ndn::crypto::computeSha256Digest(origin, 3);
+ digest3 = ndn::util::Sha256::computeDigest(origin, 3);
interestName3.append(prefix).append(name::Component(digest3));
interest3 = make_shared<Interest>(interestName3);
interest3->setInterestLifetime(time::milliseconds(100));
diff --git a/tests/unit-tests/test-leaf.cpp b/tests/unit-tests/test-leaf.cpp
index 5553a05..1588514 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-2014 University of California, Los Angeles
+ * Copyright (c) 2012-2017 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -17,13 +17,12 @@
* ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "leaf.hpp"
-#include "leaf-container.hpp"
-#include <ndn-cxx/encoding/buffer-stream.hpp>
-
#include "boost-test.hpp"
+#include "leaf-container.hpp"
+#include <ndn-cxx/encoding/buffer-stream.hpp>
+#include <ndn-cxx/util/string-helper.hpp>
namespace chronosync {
namespace test {
@@ -49,12 +48,7 @@
BOOST_AUTO_TEST_CASE(LeafDigest)
{
- using namespace CryptoPP;
-
- std::string hexResult = "05fe7f728d3341e9eff82526277b02171044124d0a52e8c4610982261c20de2b";
- ndn::OBufferStream os;
- StringSource(hexResult, true, new HexDecoder(new FileSink(os)));
- ndn::ConstBufferPtr result = os.buf();
+ std::string result = "05fe7f728d3341e9eff82526277b02171044124d0a52e8c4610982261c20de2b";
Name userPrefix("/test/name");
Leaf leaf(userPrefix, 1, 10);
@@ -62,7 +56,7 @@
BOOST_CHECK_NO_THROW(leaf.getDigest());
ndn::ConstBufferPtr digest = leaf.getDigest();
- BOOST_CHECK(*result == *digest);
+ BOOST_CHECK_EQUAL(result, ndn::toHex(digest->buf(), digest->size(), false));
}
BOOST_AUTO_TEST_CASE(Container)