quicksort and associated tests