Refactored comparison unit tests to remove boilerplate.