basic sort and reverse done with test cases