fixed tests and added new result sort test