X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FConnectors.test.cc;h=639f58b90548c66ced14200887712c8078e409e6;hb=6ba573a99f93543ee32292f79865751b3e9b89a4;hp=9277a34e9c952a770f32b0a01e82f6bc2f2ac84c;hpb=69535909437d04c0df8f95bfb242db4f36fda12d;p=senf.git diff --git a/PPI/Connectors.test.cc b/PPI/Connectors.test.cc index 9277a34..639f58b 100644 --- a/PPI/Connectors.test.cc +++ b/PPI/Connectors.test.cc @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -31,7 +31,7 @@ #include "DebugModules.hh" #include "Setup.hh" -#include +#include "../Utils/auto_unit_test.hh" #include #define prefix_ @@ -164,7 +164,7 @@ namespace { SENF_PPI_MODULE(PassiveInputTest); public: - ppi::connector::PassiveInput input; + ppi::connector::PassiveInput<> input; PassiveInputTest() : counter() { noroute(input); @@ -284,6 +284,71 @@ BOOST_AUTO_UNIT_TEST(activeOutput) // connect() is tested indirectly via ppi::connect } +namespace { + + class TypedInputTest + : public ppi::module::Module + { + SENF_PPI_MODULE(TypedInputTest); + + public: + ppi::connector::PassiveInput input; + + TypedInputTest() { + noroute(input); + input.onRequest(&TypedInputTest::request); + } + + void request() { + (void) input(); + (void) input.read(); + } + }; + + class TypedOutputTest + : public ppi::module::Module + { + SENF_PPI_MODULE(TypedOutputTest); + + public: + ppi::connector::PassiveOutput output; + + TypedOutputTest() { + noroute(output); + output.onRequest(&TypedOutputTest::request); + } + + void request() { + senf::DataPacket pkg (senf::DataPacket::create()); + output(pkg); + output.write(pkg); + } + }; + +} + +BOOST_AUTO_UNIT_TEST(typedInput) +{ + debug::ActiveSource source; + TypedInputTest target; + + ppi::connect(source,target); + ppi::init(); + + senf::Packet p (senf::DataPacket::create()); + source.submit(p); +} + +BOOST_AUTO_UNIT_TEST(tyepdOutput) +{ + TypedOutputTest source; + debug::ActiveSink target; + + ppi::connect(source,target); + ppi::init(); + + (void) target.request(); +} ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_