blob: 844877997f753e8d589a4f12287c0c762b1ee024 [file] [log] [blame]
Qiuhan Ding0cfc1512015-02-17 17:44:11 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
Varun Patila24bd3e2020-11-24 10:08:33 +05303 * Copyright (c) 2020, Regents of the University of California
Qiuhan Ding0cfc1512015-02-17 17:44:11 -08004 *
5 * BSD license, See the LICENSE file for more information
6 *
7 * Author: Qiuhan Ding <qiuhanding@cs.ucla.edu>
8 */
9
Qiuhan Ding0cfc1512015-02-17 17:44:11 -080010#include "endorse-collection.hpp"
Varun Patila24bd3e2020-11-24 10:08:33 +053011
12#include <boost/test/unit_test.hpp>
Qiuhan Ding0cfc1512015-02-17 17:44:11 -080013#include <ndn-cxx/encoding/buffer-stream.hpp>
14
Varun Patila24bd3e2020-11-24 10:08:33 +053015namespace chronochat {
Qiuhan Ding0cfc1512015-02-17 17:44:11 -080016namespace tests {
17
18using std::string;
19
20BOOST_AUTO_TEST_SUITE(TestEndorseCollection)
21
22BOOST_AUTO_TEST_CASE(EncodeDecode)
23{
24 EndorseCollection collection;
25 collection.addCollectionEntry(ndn::Name("/ndn/ucla/qiuhan"), "hash");
26 Block collectionWire;
27 BOOST_REQUIRE_NO_THROW(collectionWire = collection.wireEncode());
28 EndorseCollection decodedCollection;
29 BOOST_REQUIRE_NO_THROW(decodedCollection.wireDecode(collectionWire));
30
31 BOOST_CHECK_EQUAL(decodedCollection.getCollectionEntries().size(), 1);
32 BOOST_CHECK_EQUAL(decodedCollection.getCollectionEntries()[0].certName.toUri(),
33 string("/ndn/ucla/qiuhan"));
34 BOOST_CHECK_EQUAL(decodedCollection.getCollectionEntries()[0].hash, "hash");
35
36}
37
38BOOST_AUTO_TEST_SUITE_END()
39
40} // namespace tests
41} // namespace chronochat