Use functions to create generators in tests

That's an orthogonal change, neg() is out of scope of this PR