blob: 3e85f3812821aec29a424b111df7c94956216164 [file] [log] [blame]
Yingdi Yufa4ce792014-02-06 18:09:22 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
3 * Copyright (C) 2013 Regents of the University of California.
4 * @author: Yingdi Yu <yingdi@cs.ucla.edu>
5 * See COPYING for copyright and distribution information.
6 */
7
8#include <boost/test/unit_test.hpp>
9
Yingdi Yu0b0a7362014-08-05 16:31:30 -070010#include "profile.hpp"
11#include <ndn-cxx/encoding/buffer-stream.hpp>
Yingdi Yufa4ce792014-02-06 18:09:22 -080012
Qiuhan Ding52f13832015-03-06 14:05:59 -080013namespace chronochat {
14namespace tests {
Yingdi Yu0b0a7362014-08-05 16:31:30 -070015
16using std::string;
Yingdi Yufa4ce792014-02-06 18:09:22 -080017
18BOOST_AUTO_TEST_SUITE(TestProfile)
19
20BOOST_AUTO_TEST_CASE(EncodeDecodeProfile)
21{
22 Name identity("/ndn/ucla/yingdi");
23 Profile profile(identity);
24 profile["name"] = "Yingdi Yu";
25 profile["school"] = "UCLA";
26
Qiuhan Ding0cfc1512015-02-17 17:44:11 -080027 Block profileWire = profile.wireEncode();
Yingdi Yu0b0a7362014-08-05 16:31:30 -070028
29 Profile decodedProfile;
Qiuhan Ding0cfc1512015-02-17 17:44:11 -080030 decodedProfile.wireDecode(profileWire);
Yingdi Yu0b0a7362014-08-05 16:31:30 -070031
Yingdi Yufa4ce792014-02-06 18:09:22 -080032 BOOST_CHECK_EQUAL(decodedProfile.getIdentityName().toUri(), string("/ndn/ucla/yingdi"));
33 BOOST_CHECK_EQUAL(decodedProfile["name"], string("Yingdi Yu"));
34 BOOST_CHECK_EQUAL(decodedProfile["school"], string("UCLA"));
35}
36
Yingdi Yufa4ce792014-02-06 18:09:22 -080037BOOST_AUTO_TEST_SUITE_END()
Yingdi Yu0b0a7362014-08-05 16:31:30 -070038
Qiuhan Ding52f13832015-03-06 14:05:59 -080039} // namespace tests
40} // namespace chronochat