Summary
Vera's contracts already define what each function requires and guarantees. The three-tier verification system already classifies which properties are proved (Tier 1) vs runtime-checked (Tier 3). A vera test command would close the loop by automatically exercising Tier 3 contracts with generated inputs.
Motivation
In traditional development, tests are a separate artefact maintained alongside code. In Vera, contracts ARE the specification — requires() defines the valid input space, ensures() defines expected behavior. Test management should fall out of the language design, not be bolted on.
What this enables
- Property-based test generation —
requires() clauses define the input space; the compiler generates valid inputs automatically and checks ensures() at runtime
- Automatic coverage reporting —
vera verify already reports Tier 1 (proved) vs Tier 3 (runtime) counts; vera test would exercise the Tier 3 contracts
- No separate test files for contract-covered properties — the contracts are the tests
Possible future extensions
- Cross-function scenario testing (call A then B then C, check end-to-end properties)
- Mutation testing (change the implementation, see if any contract breaks)
- Shrinking (minimize failing inputs, as in QuickCheck/Hypothesis)
Relationship to existing work
- Contracts and verification are complete (C4/C6)
- Runtime contract insertion is working (Tier 3 checks compile to WASM)
vera verify --json already provides the tier breakdown (tier1_verified, tier3_runtime, total)
Roadmap
Fits naturally into C8 (end-to-end) or as a standalone phase.
Summary
Vera's contracts already define what each function requires and guarantees. The three-tier verification system already classifies which properties are proved (Tier 1) vs runtime-checked (Tier 3). A
vera testcommand would close the loop by automatically exercising Tier 3 contracts with generated inputs.Motivation
In traditional development, tests are a separate artefact maintained alongside code. In Vera, contracts ARE the specification —
requires()defines the valid input space,ensures()defines expected behavior. Test management should fall out of the language design, not be bolted on.What this enables
requires()clauses define the input space; the compiler generates valid inputs automatically and checksensures()at runtimevera verifyalready reports Tier 1 (proved) vs Tier 3 (runtime) counts;vera testwould exercise the Tier 3 contractsPossible future extensions
Relationship to existing work
vera verify --jsonalready provides the tier breakdown (tier1_verified,tier3_runtime,total)Roadmap
Fits naturally into C8 (end-to-end) or as a standalone phase.