Skip to content

Add tests for the gaps found by mutation testing - #47

Merged
HDauven merged 1 commit into
mainfrom
test/mutation-gaps
Oct 11, 2026
Merged

HDauven merged 1 commit into
mainfrom
test/mutation-gaps

Conversation

@HDauven

@HDauven HDauven commented Oct 10, 2026

Copy link
Copy Markdown
Member

Summary

Resolves #46.

Tests only, so there is no changelog entry. Each test fails on the mutant it targets and passes on the released dusk-safe 0.4.0.

  • Test that dropping a sponge wipes its output
  • Test the IO-pattern call length bound

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused tests correctly cover both identified mutation-testing gaps without changing library behavior.

0 open findings

What changed in this PR

Adds mutation-testing regression coverage for sponge output wiping and IO-pattern length bounds.

Changes:

  • Verifies buffered output is zeroized when an unfinished sponge is dropped.
  • Tests valid and invalid lengths around the 2^31 − 1 boundary.
File Description
src/​sponge.rs Adds drop-time output wiping coverage.
src/​lib.rs Adds IO-pattern boundary validation coverage.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Mutation testing of dusk-safe 0.4.0 found code that no test pins. Each
test below fails on the mutant it targets:

- Test that dropping a sponge wipes its output
- Test the IO-pattern call length bound
@HDauven
HDauven force-pushed the test/mutation-gaps branch from 5e59c49 to 58503ee Compare October 10, 2026 12:02
@HDauven

HDauven commented Oct 10, 2026

Copy link
Copy Markdown
Member Author

Force-pushed: squashed into one commit. The tree is unchanged.

@HDauven
HDauven marked this pull request as ready for review October 10, 2026 12:16

@moCello moCello left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

APPROVE

Both tests can fail for the reason they claim, and the change stays inside the scope of the linked issue.

The drop test watches the first buffered output element through the test allocator. If the Drop body or the output wipe in zeroize is removed, the allocator reads 99 at deallocation and the assertion fails. The length test accepts a call of exactly 2^31 − 1 and rejects 2^31 on both the absorb side and the squeeze side. This kills the >= mutant, the removed-bound mutant, and the changed-shift mutant on MAX_LEN. Both tests sit in the inline test modules next to the private items they use. The commit message, the pull request and the issue agree on the scope: tests only, with no changelog entry.

@HDauven
HDauven merged commit 0127f79 into main Oct 11, 2026
3 checks passed
@HDauven
HDauven deleted the test/mutation-gaps branch October 11, 2026 14:42
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.

Cover the test gaps found by mutation testing

3 participants