Practice ยท 1 of 2
Move time by hand
Implement FakeClock(start=0.0) and a RateLimiter(rate, window, clock) that uses it:
- FakeClock: now() returns the current value; advance(seconds) moves it forward (negative advance asserts)
- RateLimiter: allow() permits at most rate events in any window of window seconds, using ONLY the injected clock (never time.*); events older than the window stop counting
Determinism under test: the suite must be able to replay any scenario exactly.
Difficulty: advanced
Press Submit to check your solution.
Back to lesson: Practice: Deterministic Doubles