From: tho Date: Tue, 7 Aug 2007 09:30:38 +0000 (+0000) Subject: added first test case for TransportPacket X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=2a5995bedd9e4861dce1a70a460fdeb7bd0f2ad7;p=senf.git added first test case for TransportPacket git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@382 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Packets/MPEGDVBBundle/TransportPacket.hh b/Packets/MPEGDVBBundle/TransportPacket.hh index 365fee4..eecb103 100644 --- a/Packets/MPEGDVBBundle/TransportPacket.hh +++ b/Packets/MPEGDVBBundle/TransportPacket.hh @@ -115,6 +115,8 @@ namespace senf { /** \brief Transport packet typedef */ typedef TransportPacketType::packet TransportPacket; + + #define TRANSPORT_PACKET_SYNC_BYTE 0x47 } diff --git a/Packets/MPEGDVBBundle/TransportPacket.test.cc b/Packets/MPEGDVBBundle/TransportPacket.test.cc new file mode 100644 index 0000000..76c89df --- /dev/null +++ b/Packets/MPEGDVBBundle/TransportPacket.test.cc @@ -0,0 +1,94 @@ +// $Id: IpV4Packet.test.cc 364 2007-07-31 09:39:56Z g0dil $ +// +// Copyright (C) 2007 +// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) +// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// Stefan Bund +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// Unit tests + +//#include "TransportPacket.test.hh" +//#include "TransportPacket.test.ih" + +// Custom includes +#include "TransportPacket.hh" + +#include +#include + +#define prefix_ +///////////////////////////////cc.p//////////////////////////////////////// + +using namespace senf; + +BOOST_AUTO_UNIT_TEST(transportPacket_packet) +{ + // TransportStream-Packet containing a MPE encoded section with an IPv6 ping packet, + // captured with dvbsnoop + unsigned char data[] = { + 0x47, 0x41, 0x0f, 0x1e, 0x00, 0x80, 0x4c, 0x86, + 0xdd, 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, + 0x40, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x48, 0x7c, 0x7e, 0xff, 0xfe, 0x23, 0x68, + 0xaf, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x04 ,0x02, 0x8c, 0x02, 0x8c, 0x00, 0x20, 0x58, + 0xe1, 0x11, 0x05, 0x12, 0x67, 0x06, 0x2f, 0x01, + 0x00, 0x20, 0x01, 0x06, 0x38, 0x04, 0x09, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, + 0x00, 0x1d, 0xc4, 0xe8, 0xc1, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff + }; + + senf::TransportPacket p (senf::TransportPacket::create(data)); + + BOOST_CHECK_EQUAL( p->sync_byte(), TRANSPORT_PACKET_SYNC_BYTE ); + BOOST_CHECK( ! p->transport_error_indicator() ); + BOOST_CHECK( p->pusi() ); + BOOST_CHECK( ! p->transport_priority() ); + BOOST_CHECK_EQUAL( p->pid(), 0x010fu ); + BOOST_CHECK_EQUAL( p->transport_scrmbl_ctrl(), 0x0u ); + BOOST_CHECK_EQUAL( p->adaptation_field_ctrl(), 0x1u ); + BOOST_CHECK_EQUAL( p->continuity_counter(), 0x0eu ); +} + +///////////////////////////////cc.e//////////////////////////////////////// +#undef prefix_ + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 +// End: diff --git a/Packets/MPEGDVBBundle/main.test.cc b/Packets/MPEGDVBBundle/main.test.cc new file mode 100644 index 0000000..d4526a3 --- /dev/null +++ b/Packets/MPEGDVBBundle/main.test.cc @@ -0,0 +1,49 @@ +// $Id: main.test.cc 206 2007-02-20 14:20:52Z g0dil $ +// +// Copyright (C) 2007 +// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) +// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// Stefan Bund +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// Definition of non-inline non-template functions + +//#include "test.hh" +//#include "test.ih" + +// Custom includes +#define BOOST_AUTO_TEST_MAIN +#include +#include + +#define prefix_ +///////////////////////////////cc.p//////////////////////////////////////// + + +///////////////////////////////cc.e//////////////////////////////////////// +#undef prefix_ + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 +// End: