fdo#81309: Write test for out-of-place sorting.

Change-Id: Id98c080e2b1ba120b1ac4f9f27e6ab10574daa88