add unit tests for sorting.