Skip to content

test(properties): add hypothesis property-based testing and fix __iadd__ padding bug#44

Merged
schwehr merged 3 commits into
mainfrom
feat/hypothesis-testing
Jul 9, 2026
Merged

test(properties): add hypothesis property-based testing and fix __iadd__ padding bug#44
schwehr merged 3 commits into
mainfrom
feat/hypothesis-testing

Conversation

@schwehr

@schwehr schwehr commented Jul 9, 2026

Copy link
Copy Markdown
Owner
  • Add hypothesis>=6.0.0 to the dev dependency group in pyproject.toml and update uv.lock.
  • Create tests/test_properties.py with property-based test suites using hypothesis to verify mathematical invariants, involution properties, and bitwise commutativity.
  • Include the exact reproduction test case for addition after inversion as described in issue __iadd__ implementation known bad #36.
  • Fix bug in BitVector.iadd where residual 1s in destination padding words (such as from invert) were not masked out prior to bitwise ORing new bits, causing corruption when appending to modified vectors.

Fixes #36
Refs #39

schwehr added 3 commits July 9, 2026 10:11
…d__ padding bug

- Add `hypothesis>=6.0.0` to the dev dependency group in pyproject.toml and update uv.lock.
- Create tests/test_properties.py with property-based test suites using hypothesis to verify mathematical invariants, involution properties, and bitwise commutativity.
- Include the exact reproduction test case for addition after inversion as described in issue #36.
- Fix bug in BitVector.__iadd__ where residual 1s in destination padding words (such as from __invert__) were not masked out prior to bitwise ORing new bits, causing corruption when appending to modified vectors.

Fixes #36
Refs #39
- Add hypothesis strategy generating arbitrary non-negative start and stop slice indices.
- Verify BitVector slicing __getitem__ against standard Python string slicing str(bv)[start:stop] across 16-bit word boundaries.
- Add `hypofuzz>=24.0.0` to dev dependencies in pyproject.toml and update uv.lock.
- Create scripts/fuzz.sh as a dedicated executable script to run adaptive, coverage-guided continuous fuzzing on tests/test_properties.py.
- Document hypofuzz usage and continuous fuzzing commands in AGENTS.md and README.md.

Fixes #39
@schwehr
schwehr force-pushed the feat/hypothesis-testing branch from da45072 to 972296e Compare July 9, 2026 17:41
@schwehr
schwehr merged commit 20933da into main Jul 9, 2026
6 checks passed
@schwehr
schwehr deleted the feat/hypothesis-testing branch July 9, 2026 17:50
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.

__iadd__ implementation known bad

1 participant