Completed test cases for sorting functions