Skip to content

Feat: Add fuzz testing#82

Open
sumanjeet0012 wants to merge 3 commits into
ipld:masterfrom
sumanjeet0012:fix-72
Open

Feat: Add fuzz testing#82
sumanjeet0012 wants to merge 3 commits into
ipld:masterfrom
sumanjeet0012:fix-72

Conversation

@sumanjeet0012

Copy link
Copy Markdown
Contributor

Closes #72

Description

This PR adds property-based fuzz testing using the hypothesis library to ensure that py-cid can handle arbitrary or malformed input without crashing unexpectedly.

Previously, py-cid lacked fuzz tests, while Go's go-cid implementation includes extensive fuzz testing.

Changes

  • Created tests/test_fuzz.py.
  • Added test_from_bytes_never_crashes which passes arbitrary byte strings up to 200 bytes to make_cid() and ensures that only expected validation errors (ValueError, KeyError, TypeError) are raised, preventing unhandled crashes.
  • Added test_cid_roundtrip_never_crashes which verifies that successfully parsed CIDs can be safely encoded, converted to string, and prefixed without crashing.

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.

No fuzz testing

1 participant