There's no need to sort an empty array. I also added a test for sorting such array.