added test for generator function