tests[sync]: Fix test cases

Change-Id: I44b17e9647b8f9ed9b82381e0201d1d10ce1731c
diff --git a/tests/test-common.cpp b/tests/test-common.cpp
index b9a9464..55b566e 100644
--- a/tests/test-common.cpp
+++ b/tests/test-common.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2016, Regents of the University of California,
+ * Copyright (c) 2014-2017, Regents of the University of California,
  *                          Arizona Board of Regents,
  *                          Colorado State University,
  *                          University Pierre & Marie Curie, Sorbonne University,
@@ -26,6 +26,8 @@
  */
 
 #include "test-common.hpp"
+
+#include <ndn-cxx/util/digest.hpp>
 #include <ndn-cxx/security/signature-sha256-with-rsa.hpp>
 
 namespace ndn {
@@ -121,6 +123,14 @@
   return nack;
 }
 
+ConstBufferPtr
+digestFromFile(const boost::filesystem::path& filename)
+{
+  boost::filesystem::ifstream iff(filename, std::ios::in | std::ios::binary);
+  util::Sha256 digest(iff);
+  return digest.computeDigest();
+}
+
 } // namespace tests
 } // namespace chronoshare
 } // namespace ndn