Refactor sort tests