Changes according Dominic's review notes:

- xfoo and XFoo replaced by more informative names
- generated_tests replaced by loops
- use assert_throws
- code formatting