Generate test functions instead of writing them out

Yes, a bit more cluttered, but a lot less to type or c&p to add more
tests.