stable_sort and tests