Merged simple sorting test from upstream.