encoding: provide FormattedOutputFunction for Block

refs #2225

Change-Id: Ie38539ff93293b3919789043b01e09b573fb619a
diff --git a/tests/unit-tests/security/pib/pib-impl.t.cpp b/tests/unit-tests/security/pib/pib-impl.t.cpp
index 265c111..6094b0e 100644
--- a/tests/unit-tests/security/pib/pib-impl.t.cpp
+++ b/tests/unit-tests/security/pib/pib-impl.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -224,7 +224,8 @@
   BOOST_CHECK_EQUAL(this->pib.hasCertificate(this->id1Key1Cert1.getName()), true);
   BOOST_CHECK_EQUAL(this->pib.hasIdentity(this->id1), true);
   BOOST_CHECK_EQUAL(this->pib.hasKey(this->id1Key1Name), true);
-  BOOST_CHECK(this->pib.getCertificate(this->id1Key1Cert1.getName()).wireEncode() == this->id1Key1Cert1.wireEncode());
+  BOOST_CHECK_EQUAL(this->pib.getCertificate(this->id1Key1Cert1.getName()).wireEncode(),
+                    this->id1Key1Cert1.wireEncode());
   BOOST_CHECK_NO_THROW(this->pib.getDefaultCertificateOfKey(this->id1Key1Name));
   BOOST_CHECK_EQUAL(this->pib.getDefaultCertificateOfKey(this->id1Key1Name), this->id1Key1Cert1);
 
@@ -323,7 +324,7 @@
   BOOST_CHECK_EQUAL(this->pib.hasCertificate(this->id1Key1Cert1.getName()), true);
 
   auto cert = this->pib.getCertificate(this->id1Key1Cert1.getName());
-  BOOST_CHECK(cert.wireEncode() == this->id1Key1Cert1.wireEncode());
+  BOOST_CHECK_EQUAL(cert.wireEncode(), this->id1Key1Cert1.wireEncode());
 
   // Create a fake cert with the same name
   auto cert2 = this->id1Key2Cert1;
@@ -332,7 +333,7 @@
   this->pib.addCertificate(cert2);
 
   auto cert3 = this->pib.getCertificate(this->id1Key1Cert1.getName());
-  BOOST_CHECK(cert3.wireEncode() == cert2.wireEncode());
+  BOOST_CHECK_EQUAL(cert3.wireEncode(), cert2.wireEncode());
 
   // both key and certificate are overwritten
   Buffer keyBits3 = this->pib.getKeyBits(this->id1Key1Name);
diff --git a/tests/unit-tests/security/safe-bag.t.cpp b/tests/unit-tests/security/safe-bag.t.cpp
index 3c93e58..0423c69 100644
--- a/tests/unit-tests/security/safe-bag.t.cpp
+++ b/tests/unit-tests/security/safe-bag.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -150,7 +150,7 @@
   Block block(SAFE_BAG, sizeof(SAFE_BAG));
 
   // check safe bag block
-  BOOST_CHECK(wireBlock == block);
+  BOOST_CHECK_EQUAL(wireBlock, block);
 
   // wire decode
   SafeBag safeBag2;
diff --git a/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp b/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
index 658b1c2..a819279 100644
--- a/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
+++ b/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
@@ -102,7 +102,7 @@
   sig.setKeyLocator(Name("/test/another/key/locator"));
 
   const Block& encodeSigInfoBlock2 = sig.getInfo();
-  BOOST_CHECK(sigInfoBlock != encodeSigInfoBlock2);
+  BOOST_CHECK_NE(sigInfoBlock, encodeSigInfoBlock2);
 }
 
 BOOST_AUTO_TEST_CASE(DataSignature)
diff --git a/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp b/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
index 4599178..86dbb37 100644
--- a/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
+++ b/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
@@ -107,7 +107,7 @@
   sig.setKeyLocator(Name("/test/another/key/locator"));
 
   const Block& encodeSigInfoBlock2 = sig.getInfo();
-  BOOST_CHECK(sigInfoBlock != encodeSigInfoBlock2);
+  BOOST_CHECK_NE(sigInfoBlock, encodeSigInfoBlock2);
 }
 
 BOOST_AUTO_TEST_CASE(DataSignature)
diff --git a/tests/unit-tests/security/signing-info.t.cpp b/tests/unit-tests/security/signing-info.t.cpp
index 9a64a53..fc6f627 100644
--- a/tests/unit-tests/security/signing-info.t.cpp
+++ b/tests/unit-tests/security/signing-info.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -93,16 +93,16 @@
 BOOST_AUTO_TEST_CASE(CustomSignatureInfo)
 {
   SigningInfo info1;
-  BOOST_CHECK(info1.getSignatureInfo() == SignatureInfo());
+  BOOST_CHECK_EQUAL(info1.getSignatureInfo(), SignatureInfo());
 
   SignatureInfo si;
   si.setKeyLocator(Name("ndn:/test/key/locator"));
   info1.setSignatureInfo(si);
 
-  BOOST_CHECK(info1.getSignatureInfo() == si);
+  BOOST_CHECK_EQUAL(info1.getSignatureInfo(), si);
 
   SigningInfo info2(SigningInfo::SIGNER_TYPE_NULL, SigningInfo::getEmptyName(), si);
-  BOOST_CHECK(info2.getSignatureInfo() == si);
+  BOOST_CHECK_EQUAL(info2.getSignatureInfo(), si);
 }
 
 BOOST_AUTO_TEST_CASE(FromString)
diff --git a/tests/unit-tests/security/v2/additional-description.t.cpp b/tests/unit-tests/security/v2/additional-description.t.cpp
index 98431b6..7ceee8c 100644
--- a/tests/unit-tests/security/v2/additional-description.t.cpp
+++ b/tests/unit-tests/security/v2/additional-description.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -82,13 +82,13 @@
   BOOST_REQUIRE_NO_THROW(AdditionalDescription(Block(description, sizeof(description))));
   AdditionalDescription aDescription2(Block(description, sizeof(description)));
 
-  BOOST_CHECK(aDescription2 == aDescription);
+  BOOST_CHECK_EQUAL(aDescription2, aDescription);
 
   AdditionalDescription aDescription3;
   aDescription3.set("key3", "val3");
   aDescription3.set("key2", "val2");
 
-  BOOST_CHECK(aDescription2 != aDescription3);
+  BOOST_CHECK_NE(aDescription2, aDescription3);
 
   std::ostringstream os;
   os << aDescription;
diff --git a/tests/unit-tests/security/v2/key-chain.t.cpp b/tests/unit-tests/security/v2/key-chain.t.cpp
index d03f572..a4cc2f7 100644
--- a/tests/unit-tests/security/v2/key-chain.t.cpp
+++ b/tests/unit-tests/security/v2/key-chain.t.cpp
@@ -216,9 +216,9 @@
 
   // Create the third key
   Key key3 = m_keyChain.createKey(id);
-  BOOST_CHECK(key3.getName() != key2.getName());
+  BOOST_CHECK_NE(key3.getName(), key2.getName());
   // The added key will not be the default key, because the default key already exists
-  BOOST_CHECK(id.getDefaultKey().getName() == key2.getName());
+  BOOST_CHECK_EQUAL(id.getDefaultKey().getName(), key2.getName());
   BOOST_CHECK_EQUAL(id.getKeys().size(), 2);
   BOOST_REQUIRE_NO_THROW(key3.getDefaultCertificate());