added adapter & device parameters to dvb handles
[senf.git] / Packets / MPEGDVBBundle / TransportPacket.test.cc
1 // $Id$
2 //
3 // Copyright (C) 2007
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
7 //
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.
12 //
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.
17 //
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.
22
23 // Unit tests
24
25 //#include "TransportPacket.test.hh"
26 //#include "TransportPacket.test.ih"
27
28 // Custom includes
29 #include "TransportPacket.hh"
30
31 #include <boost/test/auto_unit_test.hpp>
32 #include <boost/test/test_tools.hpp>
33
34 #define prefix_
35 ///////////////////////////////cc.p////////////////////////////////////////
36
37 using namespace senf;
38
39 BOOST_AUTO_UNIT_TEST(transportPacket_packet)
40 {
41     // TransportStream-Packet containing a ULE encoded IPv6 ping packet,
42     // captured with dvbsnoop
43     unsigned char data[] = { 
44             0x47, 0x41, 0x0f, 0x1e, 0x00, 0x80, 0x4c, 0x86,
45             0xdd, 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 
46             0x40, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
47             0x00, 0x48, 0x7c, 0x7e, 0xff, 0xfe, 0x23, 0x68,
48             0xaf, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
49             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
50             0x04 ,0x02, 0x8c, 0x02, 0x8c, 0x00, 0x20, 0x58,
51             0xe1, 0x11, 0x05, 0x12, 0x67, 0x06, 0x2f, 0x01,
52             0x00, 0x20, 0x01, 0x06, 0x38, 0x04, 0x09, 0x10,
53             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11,
54             0x00, 0x1d, 0xc4, 0xe8, 0xc1, 0xff, 0xff, 0xff,
55             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
56             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
57             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
58             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
59             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
60             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
61             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
62             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
63             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
64             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
65             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
66             0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
67             0xff, 0xff, 0xff, 0xff
68     };
69             
70     senf::TransportPacket p (senf::TransportPacket::create(data));
71
72     BOOST_CHECK_EQUAL(   p->sync_byte(),                TRANSPORT_PACKET_SYNC_BYTE );
73     BOOST_CHECK(       ! p->transport_error_indicator()                            );
74     BOOST_CHECK(         p->pusi()                                                 );
75     BOOST_CHECK(       ! p->transport_priority()                                   );
76     BOOST_CHECK_EQUAL(   p->pid(),                      0x010fu                    );  
77     BOOST_CHECK_EQUAL(   p->transport_scrmbl_ctrl(),    0x0u                       );             
78     BOOST_CHECK_EQUAL(   p->adaptation_field_ctrl(),    0x1u                       );
79     BOOST_CHECK_EQUAL(   p->continuity_counter(),       0x0eu                      );  
80 }
81
82 ///////////////////////////////cc.e////////////////////////////////////////
83 #undef prefix_
84
85 \f
86 // Local Variables:
87 // mode: c++
88 // fill-column: 100
89 // c-file-style: "senf"
90 // indent-tabs-mode: nil
91 // ispell-local-dictionary: "american"
92 // compile-command: "scons -u test"
93 // comment-column: 40
94 // End: