Expand description
§TruenoVec - A Growable Array Type with Verified Correctness
This module provides TruenoVec<T>, a custom growable vector implementation
that demonstrates the certeza framework’s tiered testing approach:
- Tier 1: Unit tests for basic functionality (sub-second feedback)
- Tier 2: Property-based tests verifying algebraic properties (1-5 minutes)
- Tier 3: Formal verification of critical invariants with Kani (hours)
§Safety Invariants
The following invariants are maintained and formally verified:
ptris either null or points to valid memory forcapacityelementslen <= capacityat all times- Elements
[0..len)are initialized - Elements
[len..capacity)are uninitialized
§Risk Classification
Very High Risk - Contains unsafe code for manual memory management.
Full verification framework applied:
- Property-based testing
- 95%+ coverage requirement
-
85% mutation score target
- Formal verification of invariants
§Example
use certeza::TruenoVec;
let mut vec = TruenoVec::new();
vec.push(1);
vec.push(2);
vec.push(3);
assert_eq!(vec.len(), 3);
assert_eq!(vec.get(1), Some(&2));
assert_eq!(vec.pop(), Some(3));