HeapSort with tests