4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
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 Queueing.test unit tests */
26 //#include "Queueing.test.hh"
27 //#include "Queueing.test.ih"
30 #include "Queueing.hh"
32 #include "Connectors.hh"
33 #include "DebugModules.hh"
34 #include "../Packets/Packets.hh"
37 #include "../Utils/auto_unit_test.hh"
38 #include <boost/test/test_tools.hpp>
41 ///////////////////////////////cc.p////////////////////////////////////////
43 namespace ppi = senf::ppi;
44 namespace connector = ppi::connector;
45 namespace module = ppi::module;
46 namespace debug = module::debug;
49 class QueueTester : public module::Module
51 SENF_PPI_MODULE(QueueTester);
53 connector::PassiveInput<> input;
54 connector::ActiveOutput<> output;
58 input.qdisc(ppi::ThresholdQueueing(2,1));
59 input.onRequest(&QueueTester::nop);
62 void nop() { /* no operation */ }
72 BOOST_AUTO_UNIT_TEST(thresholdQueueing)
74 debug::ActiveSource source;
76 debug::PassiveSink sink;
78 ppi::connect(source, tester);
79 ppi::connect(tester, sink);
82 senf::Packet p (senf::DataPacket::create());
83 BOOST_CHECK( source );
85 BOOST_CHECK( source );
87 BOOST_CHECK( ! source );
88 BOOST_CHECK_EQUAL( tester.input.queueSize(), 2u );
90 BOOST_CHECK_EQUAL( tester.input.queueSize(), 1u );
91 BOOST_CHECK( source );
93 BOOST_CHECK_EQUAL( tester.input.queueSize(), 0u );
94 BOOST_CHECK( source );
97 ///////////////////////////////cc.e////////////////////////////////////////
104 // comment-column: 40
105 // c-file-style: "senf"
106 // indent-tabs-mode: nil
107 // ispell-local-dictionary: "american"
108 // compile-command: "scons -u test"