Example #1
0
TEST(EventDispatcher, Io) {
    using namespace std::placeholders;
    EventDispatcher dispatcher;
    char c = 0;
    int fd = open("/dev/zero", O_RDONLY, 0666);
    ASSERT_NE(-1, fd);
    IoEventWatcher watcher(&dispatcher, std::bind(OnIo, fd, &c, _1),
                           fd, EventMask_Read);
    watcher.Start();
    dispatcher.RunOnce();
    close(fd);
    EXPECT_EQ(0, c);
}