Make more of the tests data-driven, address other comments on test code