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

Introduce proptesting, starting with CheckPoint::range #1397

Merged
merged 1 commit into from Apr 12, 2024

Conversation

evanlinjin
Copy link
Member

Description

This is based on #1369. It made sense for me to introduce the CheckPoint::range test as a proptest. I think we should also start introducing it for other methods too.

Changelog notice

  • Added proptest for CheckPoint::range.

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

@evanlinjin evanlinjin force-pushed the fix/1354-proptest branch 3 times, most recently from 2e72cbc to c5e5cd0 Compare April 5, 2024 07:11
Copy link
Contributor

@LLFourn LLFourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK c5e5cd0

LGTM. Also in case you hadn't noticed there is also this tool: https://proptest-rs.github.io/proptest/proptest/state-machine.html

It works very nicely when you have a "model" you want to replicate. So imagine you want to compare your CheckPoint to how a BTreeMap would behave. You generate state transitions and apply them to both and compare them to see if the CheckPoint properly imitates a BTreeMap. Of course you don't need this crate to do it, it's just a structured way of doing it.

Ensure that `CheckPoint::range` returns expected values by comparing
against values returned from a primitive approach.

I think it is a good idea to start writing proptests for this crate.
@evanlinjin evanlinjin merged commit c7f87b5 into bitcoindevkit:master Apr 12, 2024
12 checks passed
@notmandatory notmandatory added this to the 1.0.0-alpha milestone Apr 12, 2024
@notmandatory notmandatory mentioned this pull request Apr 12, 2024
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants