Quicksort and associated tests