1 // $Id: TransportPacket.test.cc 389 2007-08-10 15:06:54Z tho $
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Thorsten Horstmann <thorsten.horstmann@fokus.fraunhofer.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 //#include "TLVPacket.test.hh"
26 //#include "TLVPacket.test.ih"
29 #include "TLVPacket.hh"
30 #include <senf/Packets.hh>
32 #include <boost/test/auto_unit_test.hpp>
33 #include <boost/test/test_tools.hpp>
36 ///////////////////////////////cc.p////////////////////////////////////////
40 BOOST_AUTO_UNIT_TEST(tlvPacket_parse_packet_with_extended_length)
42 unsigned char data[] = {
43 0x01, 0x23, 0x45, 0x67, // type
44 0x81, // first and last bit set => one byte length following
45 0x0A, // length (10 bytes value)
46 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A // value (payload)
49 senf::TLVPacket p (senf::TLVPacket::create(data));
54 BOOST_CHECK_EQUAL( p->type(), 0x01234567u );
55 BOOST_CHECK_EQUAL( p->length(), 0x0Au );
57 senf::PacketData & p_value (p.next().data());
58 // BOOST_CHECK_EQUAL( p_value.size(), 0x0Au);
61 ///////////////////////////////cc.e////////////////////////////////////////
68 // c-file-style: "senf"
69 // indent-tabs-mode: nil
70 // ispell-local-dictionary: "american"
71 // compile-command: "scons -u test"