The problem is that the sublists on which you invoke quicksort
can be as long as the initial list. You must ensure that the pivot element cannot be in those lists.
The easiest way to do that is to use matching to split the incoming list into pivot
and a list of remaining elements, and then pass that list to the test functions.