2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
4 // Stefan Bund <g0dil@berlios.de>
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 \brief IpV6Packet unit tests */
24 //#include "IpV6Packet.test.hh"
25 //#include "IpV6Packet.test.ih"
28 #include "IpV6Packet.hh"
29 #include "../../Socket/Protocols/INet/INetAddressing.hh"
30 #include "../../Packets/DataPacket.hh"
32 #include <boost/test/auto_unit_test.hpp>
33 #include <boost/test/test_tools.hpp>
36 ///////////////////////////////cc.p////////////////////////////////////////
38 BOOST_AUTO_UNIT_TEST(ipV6Packet_packet)
40 unsigned char data[] = { 0x60, 0x12, 0x20, 0x30,
41 0x01, 0x02, 0x03, 0x04,
42 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
43 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
44 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
45 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
48 senf::IpV6Packet p (senf::IpV6Packet::create(data));
50 BOOST_CHECK_EQUAL( p->version(), 0x06u );
51 BOOST_CHECK_EQUAL( p->trafficClass(), 0x01u );
52 BOOST_CHECK_EQUAL( p->flowLabel(), 0x22030u );
53 BOOST_CHECK_EQUAL( p->length(), 0x0102u );
54 BOOST_CHECK_EQUAL( p->nextHeader(), 0x03u );
55 BOOST_CHECK_EQUAL( p->hopLimit(), 0x04u );
56 BOOST_CHECK_EQUAL( p->source().value(),
57 senf::INet6Address::from_string("1011:1213:1415:1617:1819:1a1b:1c1d:1e1f") );
58 BOOST_CHECK_EQUAL( p->destination().value(),
59 senf::INet6Address::from_string("2021:2223:2425:2627:2829:2a2b:2c2d:2e2f") );
61 BOOST_CHECK( p.next() );
62 BOOST_CHECK( p.next().is<senf::DataPacket>() );
63 BOOST_CHECK_EQUAL( p.next().size(), 1u );
66 ///////////////////////////////cc.e////////////////////////////////////////
73 // c-file-style: "senf"
74 // indent-tabs-mode: nil
75 // ispell-local-dictionary: "american"
76 // compile-command: "scons -u test"