Junxiao Shi | 28908b7 | 2014-03-15 23:25:45 -0700 | [diff] [blame^] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2013 Regents of the University of California. |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #include "management/nfd-status.hpp" |
| 8 | #include "data.hpp" |
| 9 | |
| 10 | #include <boost/test/unit_test.hpp> |
| 11 | |
| 12 | namespace ndn { |
| 13 | namespace nfd { |
| 14 | |
| 15 | BOOST_AUTO_TEST_SUITE(NfdStatus) |
| 16 | |
| 17 | BOOST_AUTO_TEST_CASE(StatusEncode) |
| 18 | { |
| 19 | Status status1; |
| 20 | status1.setNfdVersion(1014210635); |
| 21 | status1.setStartTimestamp(Status::Timestamp(boost::chrono::seconds(375193249))); |
| 22 | status1.setCurrentTimestamp(Status::Timestamp(boost::chrono::seconds(1886109034))); |
| 23 | status1.setNNameTreeEntries(1849943160); |
| 24 | status1.setNFibEntries(621739748); |
| 25 | status1.setNPitEntries(482129741); |
| 26 | status1.setNMeasurementsEntries(1771725298); |
| 27 | status1.setNCsEntries(1264968688); |
| 28 | status1.setNInInterests(612811615); |
| 29 | status1.setNOutInterests(952144445); |
| 30 | status1.setNInDatas(1843576050); |
| 31 | status1.setNOutDatas(138198826); |
| 32 | |
| 33 | EncodingBuffer buffer; |
| 34 | status1.wireEncode(buffer); |
| 35 | |
| 36 | Data data; |
| 37 | data.setContent(buffer.buf(), buffer.size()); |
| 38 | |
| 39 | Status status2(data.getContent()); |
| 40 | BOOST_CHECK_EQUAL(status1.getNfdVersion(), status2.getNfdVersion()); |
| 41 | BOOST_CHECK_EQUAL(status1.getStartTimestamp(), status2.getStartTimestamp()); |
| 42 | BOOST_CHECK_EQUAL(status1.getCurrentTimestamp(), status2.getCurrentTimestamp()); |
| 43 | BOOST_CHECK_EQUAL(status1.getNNameTreeEntries(), status2.getNNameTreeEntries()); |
| 44 | BOOST_CHECK_EQUAL(status1.getNFibEntries(), status2.getNFibEntries()); |
| 45 | BOOST_CHECK_EQUAL(status1.getNPitEntries(), status2.getNPitEntries()); |
| 46 | BOOST_CHECK_EQUAL(status1.getNMeasurementsEntries(), status2.getNMeasurementsEntries()); |
| 47 | BOOST_CHECK_EQUAL(status1.getNCsEntries(), status2.getNCsEntries()); |
| 48 | BOOST_CHECK_EQUAL(status1.getNInInterests(), status2.getNInInterests()); |
| 49 | BOOST_CHECK_EQUAL(status1.getNOutInterests(), status2.getNOutInterests()); |
| 50 | BOOST_CHECK_EQUAL(status1.getNInDatas(), status2.getNInDatas()); |
| 51 | BOOST_CHECK_EQUAL(status1.getNOutDatas(), status2.getNOutDatas()); |
| 52 | } |
| 53 | |
| 54 | BOOST_AUTO_TEST_SUITE_END() |
| 55 | |
| 56 | } // namespace nfd |
| 57 | } // namespace ndn |