Merge sorting tests

Merging in sorting_tests from @mgehlke