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 more mutation testing to the pow module #1510

Merged
merged 3 commits into from Jan 15, 2023

Conversation

tcharding
Copy link
Member

@tcharding tcharding commented Dec 29, 2022

Add more mutation testing to the pow module.

The first two patches are preparatory clean up.

All functions/methods that are non-trivial are tested excluding:

  • to_compact_lossy
  • from_compact
  • fmt_decimal

I think its ok to not test fmt_decimal. The compact format ones require a bit of work to do but should be done at some stage.

@tcharding tcharding force-pushed the 12-29-pow-more-mutagen branch 2 times, most recently from 86cf1d3 to 0cea7ec Compare December 29, 2022 23:03
apoelstra
apoelstra previously approved these changes Dec 30, 2022
Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 0cea7ec

Fix a trivial grammatical mistake in code comment.
Plain integer does not require parenthesis, remove them.
Recently we introduced some mutation testing to the `pow` module but
testing is never done - add more `mutate` attributes and add unit tests
to ensure all mutants are killed.

Of note, the `from_compact` and `to_compact_lossy` functions are not
done, doing so results in a bunch of surviving mutants.
@tcharding
Copy link
Member Author

Changes in force push:

  • Rebase to pick up a recently merged commit
  • Pulled the trivial "remove redundant parenthesis" out into a separate patch to ease review

Copy link
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK 308c727

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 308c727

@apoelstra apoelstra merged commit 84a120d into rust-bitcoin:master Jan 15, 2023
fn u256_is_max_correct_positive() {
assert!(U256::MAX.is_max());

let u = u128::max_value();
Copy link
Member

Choose a reason for hiding this comment

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

FYI max_value() is deprecated and the MAX associated const should be used

Copy link
Member

Choose a reason for hiding this comment

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

I believe MAX is not available in 1.41.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants