X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Examples%2Fpsi2tsModule%2Fpsi2ts.test.cc;h=f2faa710044040965a424130ddcd4019e4407b88;hb=b2fff1b50e0010fdad28cb638987cbf88032e30e;hp=434cf5f6fc76f80564292400158307d46decd031;hpb=767a76da8e5b96a69b620e44d32e0a1b04005679;p=senf.git diff --git a/Examples/psi2tsModule/psi2ts.test.cc b/Examples/psi2tsModule/psi2ts.test.cc index 434cf5f..f2faa71 100644 --- a/Examples/psi2tsModule/psi2ts.test.cc +++ b/Examples/psi2tsModule/psi2ts.test.cc @@ -2,23 +2,28 @@ // // Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) -// Competence Center NETwork research (NET), St. Augustin, GERMANY -// Thorsten Horstmann // -// 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. +// The contents of this file are subject to the Fraunhofer FOKUS Public License +// Version 1.0 (the "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// http://senf.berlios.de/license.html // -// 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. +// The Fraunhofer FOKUS Public License Version 1.0 is based on, +// but modifies the Mozilla Public License Version 1.1. +// See the full license text for the amendments. // -// 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. +// Software distributed under the License is distributed on an "AS IS" basis, +// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +// for the specific language governing rights and limitations under the License. +// +// The Original Code is Fraunhofer FOKUS code. +// +// The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. +// (registered association), Hansastraße 27 c, 80686 Munich, Germany. +// All Rights Reserved. +// +// Contributor(s): +// Thorsten Horstmann /** \file \brief psi2ts unit tests */ @@ -35,7 +40,7 @@ #include #define prefix_ -///////////////////////////////cc.p//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// void check_transportpacket_header(senf::TransportPacket tsPacket, bool pusi, unsigned pid, unsigned counter) { @@ -48,7 +53,7 @@ void check_transportpacket_header(senf::TransportPacket tsPacket, bool pusi, uns BOOST_CHECK_EQUAL( tsPacket->continuity_counter(), counter ); if (pusi) BOOST_CHECK_EQUAL( tsPacket->pointer_field(), 0x0u ); - + } template @@ -56,7 +61,7 @@ bool equal_elements(InputIterator first, InputIterator last, const T& value) { return std::find_if( first, last, boost::lambda::_1 != value) == last; } - + SENF_AUTO_UNIT_TEST(one_section_to_one_transportpacket) { @@ -64,28 +69,28 @@ SENF_AUTO_UNIT_TEST(one_section_to_one_transportpacket) senf::ppi::module::debug::PassiveSink sink; unsigned PID = 42; Psi2TsModule psi2ts (PID); - + senf::ppi::connect( source, psi2ts); senf::ppi::connect( psi2ts, sink); senf::ppi::init(); - + std::string sec_data ( "psi2ts_test: one_section_to_one_transportpacket"); senf::Packet sec_packet (senf::DataPacket::create(sec_data)); sec_packet.finalize(); - + source.submit(sec_packet); BOOST_CHECK_EQUAL( sink.size(), 1u); senf::TransportPacket ts_packet = sink.pop_front().as(); check_transportpacket_header( ts_packet, true, PID, 1); senf::PacketData & ts_payload_data = ts_packet.next().data(); - BOOST_CHECK_EQUAL_COLLECTIONS( - ts_payload_data.begin(), + BOOST_CHECK_EQUAL_COLLECTIONS( + ts_payload_data.begin(), boost::next( ts_payload_data.begin(), sec_data.size()), sec_data.begin(), sec_data.end()); BOOST_CHECK( equal_elements( - boost::next( ts_payload_data.begin(), ts_payload_data.size()), + boost::next( ts_payload_data.begin(), ts_payload_data.size()), ts_payload_data.end(), 0xffu)); } @@ -96,17 +101,17 @@ SENF_AUTO_UNIT_TEST(one_section_to_two_transportpackets) senf::ppi::module::debug::PassiveSink sink; unsigned PID = 42; Psi2TsModule psi2ts (PID); - + senf::ppi::connect( source, psi2ts); senf::ppi::connect( psi2ts, sink); senf::ppi::init(); - + std::string sec_data ( 183, 0x42); std::string sec_data2 ( "psi2ts_test: one_section_to_two_transportpackets"); sec_data.append( sec_data2); senf::Packet sec_packet (senf::DataPacket::create(sec_data)); sec_packet.finalize(); - + source.submit( sec_packet); BOOST_CHECK_EQUAL( sink.size(), 2u); @@ -115,17 +120,17 @@ SENF_AUTO_UNIT_TEST(one_section_to_two_transportpackets) senf::PacketData & ts_payload_data1 = ts_packet.next().data(); BOOST_CHECK( equal_elements( ts_payload_data1.begin(), ts_payload_data1.end(), 0x42)); - + ts_packet = sink.pop_front().as(); check_transportpacket_header( ts_packet, false, PID, 2); senf::PacketData & ts_payload_data2 = ts_packet.next().data(); - BOOST_CHECK_EQUAL_COLLECTIONS( - ts_payload_data2.begin(), + BOOST_CHECK_EQUAL_COLLECTIONS( + ts_payload_data2.begin(), boost::next( ts_payload_data2.begin(), sec_data2.size()), sec_data2.begin(), sec_data2.end()); BOOST_CHECK( equal_elements( - boost::next( ts_payload_data2.begin(), sec_data2.size()), + boost::next( ts_payload_data2.begin(), sec_data2.size()), ts_payload_data2.end(), 0xffu)); } @@ -136,15 +141,15 @@ SENF_AUTO_UNIT_TEST(many_sections_to_many_transportpackets) senf::ppi::module::debug::PassiveSink sink; unsigned PID = 42; Psi2TsModule psi2ts (PID); - + senf::ppi::connect( source, psi2ts); senf::ppi::connect( psi2ts, sink); senf::ppi::init(); - + std::string sec_data ( "many_sections_to_many_transportpackets"); senf::Packet sec_packet (senf::DataPacket::create(sec_data)); sec_packet.finalize(); - + unsigned NUMBER_OF_SECTIONS = 42u; for (unsigned i=1; i<=NUMBER_OF_SECTIONS; i++) { source.submit( sec_packet); @@ -153,11 +158,11 @@ SENF_AUTO_UNIT_TEST(many_sections_to_many_transportpackets) for (unsigned i=1; i<=NUMBER_OF_SECTIONS; i++) { senf::TransportPacket ts_packet = sink.pop_front().as(); - check_transportpacket_header( ts_packet, true, PID, i%16); + check_transportpacket_header( ts_packet, true, PID, i%16); } } -///////////////////////////////cc.e//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_