Adds new qsort and head, tail tests

Also changes the qsort formula