'L{task.LoopingCall.withCount} with interval set to 0 will still keep
the time when last called so when the interval is reset.'

def test_withCountIntervalZeroDelayThenNonZeroInterval(self):

    clock = task.Clock()
    deferred = defer.Deferred()
    accumulator = []
    def foo(cnt):
        accumulator.append(cnt)
        if (len(accumulator) == 2):
            return deferred
    loop = task.LoopingCall.withCount(foo)
    loop.clock = clock
    loop.start(0, now=False)
    clock.advance(10)
    self.assertEqual([1, 1], accumulator)
    loop.interval = 2
    deferred.callback(None)
    clock.advance(7)
    self.assertEqual([1, 1, 3], accumulator)
    clock.advance(2)
    self.assertEqual([1, 1, 3, 1], accumulator)
    clock.advance(4)
    self.assertEqual([1, 1, 3, 1, 2], accumulator)
