full-producer: segment sync data
refs: #4716
Change-Id: I6776bcfd2816c1c45548c3799c1ad3e52cb3cf18
diff --git a/tests/test-state.cpp b/tests/test-state.cpp
index 0a815fd..956bbbd 100644
--- a/tests/test-state.cpp
+++ b/tests/test-state.cpp
@@ -35,35 +35,43 @@
state.addContent(ndn::Name("test1"));
state.addContent(ndn::Name("test2"));
- ndn::Data data;
- data.setContent(state.wireEncode());
- State rcvdState(data.getContent());
-
- BOOST_CHECK(state.getContent() == rcvdState.getContent());
-
// Simulate getting buffer content from segment fetcher
+ Data data;
+ data.setContent(state.wireEncode());
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::ConstBufferPtr bufferPtr = make_shared<ndn::Buffer>(buffer);
- ndn::Block block(std::move(buffer2));
+ ndn::Block block(std::move(bufferPtr));
- State state2;
- state2.wireDecode(block);
+ State rcvdState;
+ rcvdState.wireDecode(block);
- BOOST_CHECK(state.getContent() == state2.getContent());
+ BOOST_CHECK(state.getContent() == rcvdState.getContent());
}
BOOST_AUTO_TEST_CASE(EmptyContent)
{
- ndn::Data data;
- BOOST_CHECK_NO_THROW(State state(data.getContent()));
+ State state;
- State state(data.getContent());
- BOOST_CHECK_EQUAL(state.getContent().size(), 0);
+ // Simulate getting buffer content from segment fetcher
+ Data data;
+ data.setContent(state.wireEncode());
+ ndn::Buffer buffer(data.getContent().value_size());
+ std::copy(data.getContent().value_begin(),
+ data.getContent().value_end(),
+ buffer.begin());
+ ndn::ConstBufferPtr bufferPtr = make_shared<ndn::Buffer>(buffer);
+
+ ndn::Block block(std::move(bufferPtr));
+
+ BOOST_CHECK_NO_THROW(State state2(block));
+
+ State state2(block);
+ BOOST_CHECK_EQUAL(state2.getContent().size(), 0);
}
BOOST_AUTO_TEST_SUITE_END()