X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FScheduler.test.cc;h=0501762eeb925e45523907497db8069e76c292ee;hb=ee63e5771e9d69c7fe6de6c1b53b92d1307f2fc1;hp=78aaa4d29c602e0545b394160fe5f7ce094c5252;hpb=85ab07d100a382467a42e19d741d403a7a96c951;p=senf.git diff --git a/Scheduler/Scheduler.test.cc b/Scheduler/Scheduler.test.cc index 78aaa4d..0501762 100644 --- a/Scheduler/Scheduler.test.cc +++ b/Scheduler/Scheduler.test.cc @@ -1,9 +1,10 @@ + // $Id$ // // Copyright (C) 2006 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Stefan Bund +// 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 // it under the terms of the GNU General Public License as published by @@ -38,7 +39,7 @@ #include "Scheduler.hh" -#include +#include "../Utils/auto_unit_test.hh" #include #define prefix_ @@ -140,10 +141,10 @@ namespace { int size; int event; - void callback(int fd, Scheduler::EventId ev) + void callback(int fd, int ev) { event = ev; - switch (event) { + switch (event & Scheduler::EV_ALL) { case Scheduler::EV_READ: size = recv(fd,buffer,1024,0); break; @@ -155,17 +156,14 @@ namespace { size = write(fd,buffer,size); Scheduler::instance().terminate(); break; - case Scheduler::EV_HUP: - case Scheduler::EV_ERR: - case Scheduler::EV_NONE: - case Scheduler::EV_ALL: - ; } Scheduler::instance().terminate(); } + bool timeoutCalled = false; void timeout() { + timeoutCalled = true; Scheduler::instance().terminate(); } @@ -181,21 +179,43 @@ namespace { return handle.fd_; } - void handleCallback(HandleWrapper const & handle, Scheduler::EventId event) + void handleCallback(HandleWrapper const & handle, int event) { if (handle.tag_ != "TheTag") return; callback(handle.fd_,event); } - bool is_close(MicroTime a, MicroTime b) + bool is_close(ClockService::clock_type a, ClockService::clock_type b) + { + return (a