This tests the example provided for the property "a list of integers containing at least three distinct elements".
This is interesting because:
- Most property-based testing libraries will not successfully normalize (i.e. always return the same answer) this property, because it requires reordering examples to do so.
- Hypothesis and test.check both provide a built in generator for "a list of distinct elements", so the "example of size at least N" provides a sort of lower bound for how well they can shrink those built in generators.
The expected smallest falsified sample is [0, 1, -1]
or [0, 1, 2]
.
Library | Code | Report |
---|---|---|
Americium | DistinctTest.java | distinct.md |
jqwik | DistinctProperties.java | distinct.md |
PropEr | distinct.erl | distinct.md |
fast-check | distinct.js | distinct.md |
CsCheck | ShrinkingChallengeTests.cs | distinct.md |
elm-test | Distinct.elm | distinct.md |