A reasonably common counterexample might due to a list of over n count, or a string over n length.
However, the smallest example that satisfies this predicate is actually quite hard to get to, as we focus on bisecting the list whilst shrinking the elements first.
Consider the property:
public void StringProp(string s)
{
Xunit.Assert.True(s.Length < 2);
}
Takes approximately 20 shrinks to find the smallest countexample ("aa"). It also does not scale linearly:
| Length |
~Number of shrinks |
| 2 |
20 |
| 4 |
60 |
| 8 |
180 |
| 16 |
500 |
| 32 |
1500 |
We should prioritize finding the smallest example that satisfies that constraint. That is, the first shrink of a list should be shrinking all the elements to their smallest form.
A reasonably common counterexample might due to a list of over n count, or a string over n length.
However, the smallest example that satisfies this predicate is actually quite hard to get to, as we focus on bisecting the list whilst shrinking the elements first.
Consider the property:
Takes approximately 20 shrinks to find the smallest countexample ("aa"). It also does not scale linearly:
We should prioritize finding the smallest example that satisfies that constraint. That is, the first shrink of a list should be shrinking all the elements to their smallest form.