tree: list shrinking that drops elements anywhere (Shrink.list) #13
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Missing
List shrinking that removes elements anywhere (Hedgehog
Shrink.list: drop halves, quarters, ... then single elements), instead of only trailing ones.Why
listOf = bind (int lenRange) (n: vectorOf n g)shrinks the length first, which can only drop a suffix, then shrinks elements in place. A counterexample[ 5 0 0 0 7 ]keeps its zeros because dropping them means shrinking the length and moving7, which the tree cannot express. This limits the quality of every list-shaped counterexample, and aftergen.attrsOf(#4) also of attrset counterexamples (individual keys cannot be dropped).Suggested shape
tree.list/tree.interleave(HedgehogTree.interleave+Shrink.list): the shrinks of a list of trees are "remove a chunk" candidates followed by per-element shrinks.listOfandvectorOfswitch to it;recordkeepssequence.tree.sequenceusesgenList+elemAt, O(n^2) per level; measure before and after.Implemented in
6496eac, pushed to main.