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 MultiConnectorMixin.test unit tests */
26 //#include "MultiConnectorMixin.test.hh"
27 //#include "MultiConnectorMixin.test.ih"
32 #include "../Utils/auto_unit_test.hh"
33 #include <boost/test/test_tools.hpp>
36 ///////////////////////////////cc.p////////////////////////////////////////
39 // We only test the user-collection case, all other cases are already handled by
42 // Primitive duplicator
44 : public senf::ppi::module::Module,
45 public senf::ppi::module::MultiConnectorMixin<MyModule,
46 senf::ppi::connector::ActiveOutput<>,
49 SENF_PPI_MODULE(MyModule);
51 senf::ppi::connector::PassiveInput<> input;
56 input.onRequest(&MyModule::request);
60 void connectorSetup(std::auto_ptr<ConnectorType> c)
63 connectors_.push_back(boost::shared_ptr<ConnectorType>(c));
68 senf::Packet p (input());
69 for (Connectors::iterator i (connectors_.begin()), i_end (connectors_.end());
74 typedef std::vector< boost::shared_ptr<MyModule::ConnectorType> > Connectors;
75 Connectors connectors_;
77 friend class senf::ppi::module::MultiConnectorMixin<MyModule,
78 senf::ppi::connector::ActiveOutput<>,
84 BOOST_AUTO_UNIT_TEST(multiConnectorMixin_userContainer)
86 senf::ppi::module::debug::ActiveSource source;
88 senf::ppi::module::debug::PassiveSink sink1;
89 senf::ppi::module::debug::PassiveSink sink2;
91 senf::ppi::connect(source, module);
92 senf::ppi::connect(module, sink1);
93 senf::ppi::connect(module, sink2);
96 senf::Packet p (senf::DataPacket::create());
99 BOOST_CHECK_EQUAL( sink1.size(), 1u );
100 BOOST_CHECK_EQUAL( sink2.size(), 1u );
101 BOOST_CHECK( sink1.pop_front() == p );
102 BOOST_CHECK( sink2.pop_front() == p );
106 ///////////////////////////////cc.e////////////////////////////////////////
113 // comment-column: 40
114 // c-file-style: "senf"
115 // indent-tabs-mode: nil
116 // ispell-local-dictionary: "american"
117 // compile-command: "scons -u test"