You don't write unit tests for heap sort, you write them for sort. Then you get them to pass using heap sort. Later, you replace heap sort with tim sort, and you can write it quickly and with confidence, because the test suite shows you when you've succeeded.