Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add property tests for invariants #17

Merged
merged 1 commit into from
Jan 1, 2024

Conversation

meooow25
Copy link
Contributor

@meooow25 meooow25 commented Dec 18, 2023

These invariants are based on my understanding of RRB-trees. There seem to be a few variations of RRB-trees from what I could find online, so correct me if any of these do not apply to this implementation. Also, let me know if I missed some invariant that could be tested.

The added tests detect that:

  • <| can create an Unbalanced with m+1 children
  • >< can create a root Unbalanced with 1 child
  • insertAt can create a root Unbalanced with 1 child
  • deleteAt can create a root Unbalanced with 1 child

Side note: I found that shrinking sometimes seems to be taking forever but I haven't attempted to address it in this PR.

Fixes #16

@meooow25 meooow25 marked this pull request as ready for review December 18, 2023 22:54
@meooow25
Copy link
Contributor Author

@konsumlamm what do you think? Are these bugs?

@konsumlamm
Copy link
Owner

Yes, I'm pretty sure, though I didn't have enough time to investigate them yet. The failures for insertAt and deleteAt are probably not separate bugs, since they use ><.

@konsumlamm
Copy link
Owner

Those issues should now be fixed. Could you rebase, so that the CI runs again?

@meooow25
Copy link
Contributor Author

meooow25 commented Jan 1, 2024

Nice, thanks for fixing!

src/Data/RRBVector/Internal/Debug.hs Show resolved Hide resolved
src/Data/RRBVector/Internal/Debug.hs Outdated Show resolved Hide resolved
src/Data/RRBVector/Internal/Debug.hs Outdated Show resolved Hide resolved
@konsumlamm
Copy link
Owner

Great work, thank you very much!

@konsumlamm konsumlamm merged commit f4326ff into konsumlamm:master Jan 1, 2024
9 checks passed
@meooow25 meooow25 deleted the invariants branch February 8, 2024 14:33
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.

Property tests for invariants
2 participants