Test sort helper