TDD: implemented and passed sorting test case.