X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPPI%2FRoute.test.cc;h=9f03d290d32531e5f589da7d7c3d7bf0c67f5d75;hb=93d9568d448749dc187e7622b733a4a3caa319df;hp=6130159b58871e969427d7421884084ec8508c4a;hpb=767a76da8e5b96a69b620e44d32e0a1b04005679;p=senf.git diff --git a/senf/PPI/Route.test.cc b/senf/PPI/Route.test.cc index 6130159..9f03d29 100644 --- a/senf/PPI/Route.test.cc +++ b/senf/PPI/Route.test.cc @@ -43,7 +43,7 @@ #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; } @@ -145,9 +145,9 @@ SENF_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 @@ SENF_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 @@ SENF_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,7 +209,7 @@ namespace { } private: void request() { - SENF_ASSERT(input()); + SENF_ASSERT(input(), "TestSink called without packet"); } }; } @@ -220,25 +220,27 @@ SENF_AUTO_UNIT_TEST(connect_runtime) 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_