X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPPI%2FRoute.test.cc;h=9f03d290d32531e5f589da7d7c3d7bf0c67f5d75;hb=93d9568d448749dc187e7622b733a4a3caa319df;hp=68e7ffdafc6d1c62bb92f1a8902211608a6d8d03;hpb=601d1f509f5bb24df167a4dd5a20da67a0af9af8;p=senf.git diff --git a/senf/PPI/Route.test.cc b/senf/PPI/Route.test.cc index 68e7ffd..9f03d29 100644 --- a/senf/PPI/Route.test.cc +++ b/senf/PPI/Route.test.cc @@ -36,14 +36,14 @@ #include "CloneSource.hh" #include "Joins.hh" #include "PassiveQueue.hh" -#include "../Utils/membind.hh" -#include "../Utils/senfassert.hh" +#include +#include -#include "../Utils/auto_unit_test.hh" +#include #include #define prefix_ -///////////////////////////////cc.p//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// namespace ppi = senf::ppi; namespace connector = ppi::connector; @@ -65,7 +65,7 @@ namespace { ppi::DebugEvent event; ppi::ForwardingRoute * rt; - + RouteTester() : events(0), throttles(0) { route( activeIn, activeOut ); // non-forwarding rt = & route( activeIn, passiveOut ); // forward throttling @@ -99,7 +99,7 @@ namespace { void throttleRequest() { ++ throttles; } - + void unthrottleRequest() { -- throttles; } @@ -109,7 +109,7 @@ namespace { }; } -BOOST_AUTO_UNIT_TEST(route) +SENF_AUTO_UNIT_TEST(route) { debug::PassiveSource passiveSource; debug::ActiveSource activeSource; @@ -145,9 +145,9 @@ BOOST_AUTO_UNIT_TEST(route) passiveSink.input.unthrottle(); BOOST_CHECK( activeSource ); BOOST_CHECK( tester.event.enabled() ); - + // Now throttle the passive source by exhausting the queue - + BOOST_CHECK( p1 == activeSink.request() ); BOOST_CHECK( passiveSource.output.throttled() ); BOOST_CHECK( ! tester.activeIn ); @@ -155,7 +155,7 @@ BOOST_AUTO_UNIT_TEST(route) BOOST_CHECK( tester.passiveOut.throttled() ); BOOST_CHECK( ! activeSink ); BOOST_CHECK( ! tester.event.enabled() ); - + passiveSource.submit(p1); BOOST_CHECK( activeSink ); BOOST_CHECK( tester.event.enabled() ); @@ -178,14 +178,14 @@ BOOST_AUTO_UNIT_TEST(route) BOOST_CHECK( activeSink ); } -/////////////////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // test connection new modules on runtime namespace { void timeout() { senf::scheduler::terminate(); } - + // just a helper class for the test struct ModuleConnector { module::PriorityJoin & join_; @@ -197,7 +197,7 @@ namespace { } boost::scoped_ptr queue; }; - + class TestSink : public module::Module { SENF_PPI_MODULE(TestSink); @@ -209,36 +209,38 @@ namespace { } private: void request() { - SENF_ASSERT(input()); + SENF_ASSERT(input(), "TestSink called without packet"); } }; } -BOOST_AUTO_UNIT_TEST(connect_runtime) +SENF_AUTO_UNIT_TEST(connect_runtime) { TestSink sink; module::ActiveFeeder feeder; module::PriorityJoin join; module::CloneSource source1 (senf::DataPacket::create()); - + ppi::connect( source1, join); ppi::connect( join, feeder); ppi::connect( feeder, sink); - + ModuleConnector moduleConnector ( join); - senf::scheduler::TimerEvent timer ( + senf::scheduler::TimerEvent timer ( "connect_runtime timer", senf::membind(&ModuleConnector::connect, &moduleConnector), senf::ClockService::now() + senf::ClockService::milliseconds(250)); - + senf::scheduler::TimerEvent timeoutTimer ( "connect_runtime test timeoutTimer", &timeout, senf::ClockService::now() + senf::ClockService::milliseconds(500)); - + senf::ppi::run(); + + BOOST_CHECK( true ); } -///////////////////////////////cc.e//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_