blob: b50f0247d740d2ba7bdc7a12741d82bf0ae65382 [file] [log] [blame]
Yingdi Yub6fb0302014-01-21 11:05:11 -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 <profile.h>
9
10#define BOOST_TEST_MODULE ChronoChat
11#include <boost/test/unit_test.hpp>
12
13using namespace ndn;
14using namespace std;
15
16BOOST_AUTO_TEST_SUITE(ProfileTests)
17
18BOOST_AUTO_TEST_CASE(WriteRead)
19{
20 Name identity("/ndn/ucla/yingdi");
21 Profile profile(identity);
22 profile.setProfileEntry(string("name"), string("Yingdi Yu"));
23 profile.setProfileEntry(string("school"), string("UCLA"));
24
25 string encoded;
26 profile.encode(&encoded);
27
28 ptr_lib::shared_ptr<Profile> decodedProfile = Profile::decode(encoded);
29
30 BOOST_CHECK_EQUAL(decodedProfile->getIdentityName().toUri(), string("/ndn/ucla/yingdi"));
31 BOOST_CHECK_EQUAL(decodedProfile->getProfileEntry(string("name")), string("Yingdi Yu"));
32 BOOST_CHECK_EQUAL(decodedProfile->getProfileEntry(string("school")), string("UCLA"));
33}
34
35BOOST_AUTO_TEST_SUITE_END()