Skip to content

Conversation

thepaul
Copy link

@thepaul thepaul commented Apr 3, 2025

There is a bug causing minmax heap invariants to be violated in certain conditions when using Remove() or Fix().

I also added a lot to the test suite to aid in debugging and visualizing the problem.

thepaul added 6 commits April 2, 2025 20:36
Rather than relying on Seed(0), try things in a different order every
time. The seed is logged so that if something fails, the problem can be
reproduced using the -seed flag.
Removes elements from a larger minmax heap in a random order, making
sure all elements were yielded and no non-elements were yielded.
This can be used when a test fails unexpectedly to show the structure of
the tree and where values are.

Perhaps this is overkill, but I found it very useful.
This now checks that grandchildren have the correct relationship to
nodes. Without this, it was possible for an invalid tree to pass
verify().
This appears to fix all of the ordering problems I have been
experiencing so far.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant