News for hackers. Stuff that matters.
Re:Hypothesis: Property-Based Testing for Python by rowanG077 on Wednesday November 05, 2025 @04:09AM (#45820959)
On more complex logic you can often reason about many invariants. I don't think using sorting and then comparing to the existing sort is a good example. Precisely for the reason you mention.

A sort itself is a good example though. You can do much better then just compare to an existing sort implementation. Because you can easily check if an array is sorted with a linear scan. If your sort is stable you can do an additional check that for all pairs of adjacent elements that compare as equal the order of them is the same as in the input array.

There are no comments on this comment yet.