Sort by title with tests