Qiuhan Ding | 0cfc151 | 2015-02-17 17:44:11 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
Varun Patil | a24bd3e | 2020-11-24 10:08:33 +0530 | [diff] [blame] | 3 | * Copyright (c) 2020, Regents of the University of California |
Qiuhan Ding | 0cfc151 | 2015-02-17 17:44:11 -0800 | [diff] [blame] | 4 | * |
| 5 | * BSD license, See the LICENSE file for more information |
| 6 | * |
| 7 | * Author: Qiuhan Ding <qiuhanding@cs.ucla.edu> |
| 8 | */ |
| 9 | |
Qiuhan Ding | 0cfc151 | 2015-02-17 17:44:11 -0800 | [diff] [blame] | 10 | #include "conf.hpp" |
Varun Patil | a24bd3e | 2020-11-24 10:08:33 +0530 | [diff] [blame] | 11 | |
| 12 | #include <boost/test/unit_test.hpp> |
Qiuhan Ding | 0cfc151 | 2015-02-17 17:44:11 -0800 | [diff] [blame] | 13 | #include <ndn-cxx/encoding/buffer-stream.hpp> |
| 14 | |
Varun Patil | a24bd3e | 2020-11-24 10:08:33 +0530 | [diff] [blame] | 15 | namespace chronochat { |
Qiuhan Ding | 0cfc151 | 2015-02-17 17:44:11 -0800 | [diff] [blame] | 16 | namespace tests { |
| 17 | |
| 18 | using std::string; |
| 19 | |
| 20 | BOOST_AUTO_TEST_SUITE(TestConf) |
| 21 | |
| 22 | BOOST_AUTO_TEST_CASE(EncodeDecode) |
| 23 | { |
| 24 | string nick("qiuhan"); |
| 25 | Name identity("/ndn/edu/ucla/qiuhan"); |
| 26 | Conf conf; |
| 27 | conf.setIdentity(identity); |
| 28 | conf.setNick(nick); |
| 29 | |
| 30 | Block confWire; |
| 31 | BOOST_REQUIRE_NO_THROW(confWire = conf.wireEncode()); |
| 32 | Conf decodedConf; |
| 33 | BOOST_REQUIRE_NO_THROW(decodedConf.wireDecode(confWire)); |
| 34 | |
| 35 | BOOST_CHECK_EQUAL(decodedConf.getNick(), nick); |
| 36 | BOOST_CHECK_EQUAL(decodedConf.getIdentity(), identity); |
| 37 | } |
| 38 | |
| 39 | BOOST_AUTO_TEST_SUITE_END() |
| 40 | |
| 41 | } // namespace tests |
| 42 | } // namespace chronochat |