test: change namespace to chronochat
Change-Id: I7a8a43cb37b6b2002111264a797992f12269105e
Refs: #2591
diff --git a/test/profile.t.cpp b/test/profile.t.cpp
new file mode 100644
index 0000000..c003c70
--- /dev/null
+++ b/test/profile.t.cpp
@@ -0,0 +1,47 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Yingdi Yu <yingdi@cs.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#include <boost/test/unit_test.hpp>
+
+#include "profile.hpp"
+#include <ndn-cxx/encoding/buffer-stream.hpp>
+
+namespace chronochat {
+namespace tests {
+
+using std::string;
+
+BOOST_AUTO_TEST_SUITE(TestProfile)
+
+BOOST_AUTO_TEST_CASE(EncodeDecodeProfile)
+{
+ Name identity("/ndn/ucla/yingdi");
+ Profile profile(identity);
+ profile["name"] = "Yingdi Yu";
+ profile["school"] = "UCLA";
+
+ ndn::OBufferStream os;
+ profile.encode(os);
+
+ ndn::ConstBufferPtr encoded = os.buf();
+
+ boost::iostreams::stream
+ <boost::iostreams::array_source> is(reinterpret_cast<const char*>(encoded->buf()),
+ encoded->size ());
+
+ Profile decodedProfile;
+ decodedProfile.decode(is);
+
+ BOOST_CHECK_EQUAL(decodedProfile.getIdentityName().toUri(), string("/ndn/ucla/yingdi"));
+ BOOST_CHECK_EQUAL(decodedProfile["name"], string("Yingdi Yu"));
+ BOOST_CHECK_EQUAL(decodedProfile["school"], string("UCLA"));
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace chronochat