Skip to content

Add vera test contract-driven testing (#79)#168

Merged
aallan merged 1 commit into
mainfrom
add-vera-test
Mar 1, 2026
Merged

Add vera test contract-driven testing (#79)#168
aallan merged 1 commit into
mainfrom
add-vera-test

Conversation

@aallan

@aallan aallan commented Mar 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • New vera test command: generates inputs from requires() clauses via Z3, executes compiled WASM, validates ensures() at runtime
  • Tier classification: Tier 1 functions reported as "verified", Tier 3 functions exercised with generated inputs, generic/unsupported functions skipped
  • Z3-based input generation for Int, Nat, Bool parameters with boundary value seeding
  • --json, --trials N, --fn name flags
  • New vera/tester.py module (~530 lines) with public test() API
  • E7xx error code range (E700-E702)
  • 24 new tests (13 unit + 11 CLI), 1,100 total
  • Documentation updated: CLAUDE.md, AGENTS.md, SKILLS.md, TESTING.md, README.md, vera/README.md
  • Version bump to v0.0.47

Test plan

  • pytest tests/ -v -- 1,100 tests pass
  • mypy vera/ -- clean (41 source files)
  • python scripts/check_examples.py -- 14 examples pass
  • python scripts/check_version_sync.py -- version consistent
  • python scripts/check_readme_examples.py -- README blocks parse
  • vera test examples/safe_divide.vera -- smoke test works
  • vera test --json examples/factorial.vera -- JSON output works
  • Pre-commit hooks pass (all 11 hooks)

Closes #79

Generated with Claude Code

New `vera test` command generates inputs from requires() clauses via Z3
and executes compiled WASM to validate ensures() at runtime. Functions
are classified by tier: Tier 1 (proved by Z3) reported as "verified",
Tier 3 (runtime-checked) exercised with generated inputs, and
generic/unsupported functions skipped.

Features:
- Z3-based input generation for Int, Nat, Bool parameters
- Boundary value seeding before diversity loop
- --json, --trials N, --fn name flags
- E7xx error code range (E700-E702)
- 24 new tests (1,100 total)

Co-Authored-By: Claude <noreply@anthropic.invalid>
@aallan aallan merged commit ac8609b into main Mar 1, 2026
10 checks passed
@aallan aallan deleted the add-vera-test branch March 1, 2026 18:23
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.

Contract-driven testing: vera test command

1 participant