blob: 1af3f6bea1fe3c825c0bc199bd085996387c64c5 [file] [log] [blame]
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2013, Regents of the University of California
*
* BSD license, See the LICENSE file for more information
*
* Author: Qiuhan Ding <qiuhanding@cs.ucla.edu>
*/
#include <boost/test/unit_test.hpp>
#include "endorse-collection.hpp"
#include <ndn-cxx/encoding/buffer-stream.hpp>
namespace chronochat{
namespace tests {
using std::string;
BOOST_AUTO_TEST_SUITE(TestEndorseCollection)
BOOST_AUTO_TEST_CASE(EncodeDecode)
{
EndorseCollection collection;
collection.addCollectionEntry(ndn::Name("/ndn/ucla/qiuhan"), "hash");
Block collectionWire;
BOOST_REQUIRE_NO_THROW(collectionWire = collection.wireEncode());
EndorseCollection decodedCollection;
BOOST_REQUIRE_NO_THROW(decodedCollection.wireDecode(collectionWire));
BOOST_CHECK_EQUAL(decodedCollection.getCollectionEntries().size(), 1);
BOOST_CHECK_EQUAL(decodedCollection.getCollectionEntries()[0].certName.toUri(),
string("/ndn/ucla/qiuhan"));
BOOST_CHECK_EQUAL(decodedCollection.getCollectionEntries()[0].hash, "hash");
}
BOOST_AUTO_TEST_SUITE_END()
} // namespace tests
} // namespace chronochat