partial sync: segment hello and sync data

add segment publisher

refs: #4662

Change-Id: I62e7a2247bac58aeec364cd2a4e4d34259eae4af
This commit is contained in:
Ashlesh Gawande committed 2018-11-15 11:27:59 -06:00
1 parent deb73f8a97
commit ec43b3634b
18 files changed
+618 -225

No files matched your search

+25 -1
View File
@@ -29,7 +29,7 @@ using namespace ndn;
BOOST_AUTO_TEST_SUITE(TestState)
BOOST_AUTO_TEST_CASE(EncodeDeode)
BOOST_AUTO_TEST_CASE(EncodeDecode)
{
State state;
state.addContent(ndn::Name("test1"));
@@ -40,6 +40,30 @@ BOOST_AUTO_TEST_CASE(EncodeDeode)
State rcvdState(data.getContent());
BOOST_CHECK(state.getContent() == rcvdState.getContent());
// Simulate getting buffer content from segment fetcher
ndn::Buffer buffer(data.getContent().value_size());
std::copy(data.getContent().value_begin(),
data.getContent().value_end(),
buffer.begin());
ndn::ConstBufferPtr buffer2 = make_shared<ndn::Buffer>(buffer);
ndn::Block block(std::move(buffer2));
State state2;
state2.wireDecode(block);
BOOST_CHECK(state.getContent() == state2.getContent());
}
BOOST_AUTO_TEST_CASE(EmptyContent)
{
ndn::Data data;
BOOST_CHECK_NO_THROW(State state(data.getContent()));
State state(data.getContent());
BOOST_CHECK_EQUAL(state.getContent().size(), 0);
}
BOOST_AUTO_TEST_SUITE_END()