Refactor generator tests

Remove some test duplication. Remove some warnings for unused variables.