PPI: Add optional template arg for packet type to connectors
[senf.git] / PPI / Connectors.test.cc
index feb7266..9a8b93b 100644 (file)
@@ -1,8 +1,8 @@
 // $Id$
 //
 // Copyright (C) 2007 
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+// Fraunhofer Institute for Open Communication Systems (FOKUS) 
+// Competence Center NETwork research (NET), St. Augustin, GERMANY 
 //     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
@@ -31,7 +31,7 @@
 #include "DebugModules.hh"
 #include "Setup.hh"
 
-#include <boost/test/auto_unit_test.hpp>
+#include "../Utils/auto_unit_test.hh"
 #include <boost/test/test_tools.hpp>
 
 #define prefix_
@@ -49,8 +49,8 @@ BOOST_AUTO_UNIT_TEST(connector)
     // It doesn't matter, which type of connectors we use here since they are all based on
     // Connector.
 
-    debug::ActivePacketSource source;
-    debug::PassivePacketSink target;
+    debug::ActiveSource source;
+    debug::PassiveSink target;
 
     ppi::connect(source.output,target.input);
     ppi::init();
@@ -63,13 +63,13 @@ BOOST_AUTO_UNIT_TEST(connector)
 
 BOOST_AUTO_UNIT_TEST(passiveConnector)
 {
-    debug::ActivePacketSource source;
-    debug::PassivePacketSink target;
+    debug::ActiveSource source;
+    debug::PassiveSink target;
 
     ppi::connect(source.output,target.input);
     ppi::init();
 
-    // onRequest is implicitly tested within the PassivePacketSink implementation which is tested
+    // onRequest is implicitly tested within the PassiveSink implementation which is tested
     // in DebugModules.test.cc
 
     target.input.throttle();
@@ -92,8 +92,8 @@ namespace {
 
 BOOST_AUTO_UNIT_TEST(activeConnector)
 {
-    debug::ActivePacketSource source;
-    debug::PassivePacketSink target;
+    debug::ActiveSource source;
+    debug::PassiveSink target;
 
     ppi::connect(source.output,target.input);
     ppi::init();
@@ -124,16 +124,16 @@ BOOST_AUTO_UNIT_TEST(activeConnector)
 
 BOOST_AUTO_UNIT_TEST(inputConnector)
 {
-    debug::ActivePacketSource source;
-    debug::PassivePacketSink target;
+    debug::ActiveSource source;
+    debug::PassiveSink target;
 
     ppi::connect(source.output,target.input);
     ppi::init();
 
-    // operator() is implicitly tested within the Active/PassivePacketSink implementation which is
+    // operator() is implicitly tested within the Active/PassiveSink implementation which is
     // tested in DebugModules.test.cc
 
-    // peek() is implicitly tested within the Active/PassivePacketSink implementation
+    // peek() is implicitly tested within the Active/PassiveSink implementation
 
     BOOST_CHECK_EQUAL ( & target.input.peer(), & source.output );
     
@@ -144,13 +144,13 @@ BOOST_AUTO_UNIT_TEST(inputConnector)
 
 BOOST_AUTO_UNIT_TEST(outputConnector)
 {
-    debug::ActivePacketSource source;
-    debug::PassivePacketSink target;
+    debug::ActiveSource source;
+    debug::PassiveSink target;
 
     ppi::connect(source.output,target.input);
     ppi::init();
 
-    // operator() is implicitly tested within the Active/PassivePacketSource implementation which is
+    // operator() is implicitly tested within the Active/PassiveSource implementation which is
     // tested in DebugModules.test.cc
 
     BOOST_CHECK_EQUAL( & source.output.peer(), & target.input );
@@ -158,17 +158,17 @@ BOOST_AUTO_UNIT_TEST(outputConnector)
 
 namespace {
 
-    class PassiveInputTest
+    class GenericPassiveInputTest
         : public ppi::module::Module
     {
-        SENF_PPI_MODULE(PassiveInputTest);
+        SENF_PPI_MODULE(GenericPassiveInputTest);
 
     public:
-        ppi::connector::PassiveInput input;
+        ppi::connector::GenericPassiveInput input;
 
-        PassiveInputTest() : counter() {
+        GenericPassiveInputTest() : counter() {
             noroute(input);
-            input.onRequest(&PassiveInputTest::request);
+            input.onRequest(&GenericPassiveInputTest::request);
         }
 
         void request() {
@@ -181,10 +181,10 @@ namespace {
 
 BOOST_AUTO_UNIT_TEST(passiveInput)
 {
-    debug::ActivePacketSource source;
-    PassiveInputTest target;
+    debug::ActiveSource source;
+    GenericPassiveInputTest target;
 
-    ppi::connect(source.output,target.input);
+    ppi::connect(source,target);
     ppi::init();
 
     BOOST_CHECK_EQUAL( & target.input.peer(), & source.output );
@@ -224,10 +224,10 @@ BOOST_AUTO_UNIT_TEST(passiveInput)
 
 BOOST_AUTO_UNIT_TEST(passiveOutput)
 {
-    debug::PassivePacketSource source;
-    debug::ActivePacketSink target;
+    debug::PassiveSource source;
+    debug::ActiveSink target;
 
-    ppi::connect(source.output,target.input);
+    ppi::connect(source,target);
     ppi::init();
 
     senf::Packet p (senf::DataPacket::create());
@@ -245,10 +245,10 @@ BOOST_AUTO_UNIT_TEST(passiveOutput)
 
 BOOST_AUTO_UNIT_TEST(activeInput)
 {
-    debug::PassivePacketSource source;
-    debug::ActivePacketSink target;
+    debug::PassiveSource source;
+    debug::ActiveSink target;
 
-    ppi::connect(source.output,target.input);
+    ppi::connect(source,target);
     ppi::init();
 
     BOOST_CHECK_EQUAL( & target.input.peer(), & source.output );
@@ -270,10 +270,10 @@ BOOST_AUTO_UNIT_TEST(activeInput)
 
 BOOST_AUTO_UNIT_TEST(activeOutput)
 {
-    debug::ActivePacketSource source;
-    debug::PassivePacketSink target;
+    debug::ActiveSource source;
+    debug::PassiveSink target;
 
-    ppi::connect(source.output,target.input);
+    ppi::connect(source,target);
     ppi::init();
     
     BOOST_CHECK_EQUAL( & source.output.peer(), & target.input );