refact rotatedSortedArray, add unittest code