blob: c2fab266e454dfc0d6ff101723674bbe36ca7aa1 [file] [log] [blame]
Alexander Afanasyev233750e2014-02-16 00:50:07 -08001/**
2 * Copyright (C) 2013 Regents of the University of California.
3 * See COPYING for copyright and distribution information.
4 */
5
6#include <boost/test/unit_test.hpp>
7
8#include "encoding/encoding-buffer.hpp"
9
10using namespace std;
11namespace ndn {
12
13BOOST_AUTO_TEST_SUITE(TestBlock)
14
15BOOST_AUTO_TEST_CASE (Decode)
16{
17 uint8_t value[4];
18
19 ndn::EncodingBuffer buffer;
20 size_t length = buffer.prependByteArray(value, sizeof(value));
21 buffer.prependVarNumber(length);
22 buffer.prependVarNumber(0xe0);
23
24 Block block;
25 BOOST_REQUIRE_NO_THROW(block = buffer.block());
26 BOOST_CHECK_EQUAL(block.type(), 0xe0);
27 BOOST_CHECK_EQUAL(block.value_size(), sizeof(value));
28}
29
30BOOST_AUTO_TEST_SUITE_END()
31
32} // namespace ndn