4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <g0dil@berlios.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.
24 \brief DebubgModules.test unit tests */
26 //#include "DebubgModules.test.hh"
27 //#include "DebubgModules.test.ih"
31 #include "Packets/Packets.hh"
32 #include "DebugModules.hh"
35 #include <boost/test/auto_unit_test.hpp>
36 #include <boost/test/test_tools.hpp>
39 ///////////////////////////////cc.p////////////////////////////////////////
41 BOOST_AUTO_UNIT_TEST(debugModules)
43 namespace debug = senf::ppi::module::debug;
44 namespace ppi = senf::ppi;
47 debug::ActivePacketSource source;
48 debug::PassivePacketSink sink;
50 ppi::connect(source, sink);
53 senf::PacketData::byte data[] = { 0x13u, 0x24u, 0x35u };
54 senf::Packet p (senf::DataPacket::create(data));
56 BOOST_CHECK( ! sink.input.throttled() );
60 BOOST_CHECK( ! sink.input.throttled() );
61 BOOST_CHECK_EQUAL( sink.size(), 1u );
62 BOOST_CHECK( ! sink.empty() );
64 debug::PassivePacketSink::size_type(std::distance(sink.begin(),sink.end())),
66 BOOST_CHECK( *sink.begin() == p );
67 BOOST_CHECK( sink.front() == p );
71 BOOST_CHECK( ! sink.front() );
72 BOOST_CHECK( sink.empty() );
76 debug::PassivePacketSource source;
77 debug::ActivePacketSink sink;
79 ppi::connect(source, sink);
82 senf::PacketData::byte data[] = { 0x13u, 0x24u, 0x35u };
83 senf::Packet p (senf::DataPacket::create(data));
87 BOOST_CHECK_EQUAL( source.size(), 1u );
88 BOOST_CHECK_EQUAL( sink.request(), p );
89 BOOST_CHECK_EQUAL( source.size(), 0u );
90 BOOST_CHECK( source.empty() );
94 ///////////////////////////////cc.e////////////////////////////////////////
101 // comment-column: 40
102 // c-file-style: "senf"
103 // indent-tabs-mode: nil
104 // ispell-local-dictionary: "american"
105 // compile-command: "scons -u test"