1 unstable release
new 0.0.2 | Jan 7, 2025 |
---|---|
0.0.1 |
|
#530 in Procedural macros
202 downloads per month
21KB
405 lines
AUTO-KANI
Generate test harness for target function accoding to its signature. The test harness will be checked by kani.
Features
The generated harness is capable to catch some common errors, e.g., arithmetic overflow, illegal raw pointer dereference, illegal memory access, run-time panic.
Usage
Support for target struct:
Add #[kani_arbitrary]
to target struct or add #[extend_arbitrary]
to the basic impl block of target struct;
One struct can only deploy one of
#[kani_arbitrary]
or#[extend_arbitrary]
;#[extend_arbitrary]
is more recommended for less false alarms.
Run the kani harness:
- Add
#[kani_test]
for target function - Run
cargo kani --harness check_{function_name}
for specific target orcargo kani
for all selected functions.
If the code involves raw pointers, use
cargo kani -Z mem-predicates
.
Dependencies
~1.5MB
~37K SLoC