Check for correct sort and stable order for matching values.
Reviewers: campbellbarton Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D708