Changes according Dominic's review notes:
- xfoo and XFoo replaced by more informative names
- generate_tests replaced by loops
- use assert-throws
- code formatting