Alexander Afanasyev | 233750e | 2014-02-16 00:50:07 -0800 | [diff] [blame^] | 1 | /** |
| 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 | |
| 10 | using namespace std; |
| 11 | namespace ndn { |
| 12 | |
| 13 | BOOST_AUTO_TEST_SUITE(TestBlock) |
| 14 | |
| 15 | BOOST_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 | |
| 30 | BOOST_AUTO_TEST_SUITE_END() |
| 31 | |
| 32 | } // namespace ndn |