icu4x icon indicating copy to clipboard operation
icu4x copied to clipboard

Change collator tests to check that all ways of comparing agree

Open hsivonen opened this issue 4 months ago • 3 comments

We should have fuzzing to check that compare and write_sort_key_to agree.

hsivonen avatar Aug 14 '25 07:08 hsivonen

CC @rs-sac

hsivonen avatar Aug 14 '25 07:08 hsivonen

Fuzzing does not seem right for this.

What I do in ICU unit tests is that every time I expect compare(s1, s2) to return some value, I use a test helper function that calls every possible way to do the comparison -- UTF-16 strings, UTF-8 strings, character iterator, sort keys -- and that they all yield the same result.

markusicu avatar Aug 14 '25 22:08 markusicu

What I do in ICU unit tests is that every time I expect compare(s1, s2) to return some value, I use a test helper function that calls every possible way to do the comparison -- UTF-16 strings, UTF-8 strings, character iterator, sort keys -- and that they all yield the same result.

Yeah, we should do it that way. Changed the issue title.

hsivonen avatar Oct 28 '25 12:10 hsivonen