How to test a generator