'Verify that we don\'t lose an event when more than EVENTS_PER_LOOP
events occur in the same reactor iteration'

def test_maxEventsPerIteration(self):

    class FakeFD:
        counter = 0
        def logPrefix(self):
            return 'FakeFD'
        def cb(self, rc, bytes, evt):
            self.counter += 1
    ir = IOCPReactor()
    fd = FakeFD()
    event = _iocp.Event(fd.cb, fd)
    for _ in range((EVENTS_PER_LOOP + 1)):
        ir.port.postEvent(0, KEY_NORMAL, event)
    ir.doIteration(None)
    self.assertEqual(fd.counter, EVENTS_PER_LOOP)
    ir.doIteration(0)
    self.assertEqual(fd.counter, (EVENTS_PER_LOOP + 1))
