You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to testing, you write a harness, but with Kani you can check all possible values using kani::any():
use my_crate::{function_under_test, meets_specification, precondition};#[kani::proof]fncheck_my_property(){// Create a nondeterministic inputlet input = kani::any();// Constrain it according to the function's precondition
kani::assume(precondition(input));// Call the function under verificationlet output = function_under_test(input);// Check that it meets the specificationassert!(meets_specification(input, output));}
Kani will then try to prove that all valid inputs produce acceptable outputs, without panicking or executing unexpected behavior.
Otherwise Kani will generate a trace that points to the failure.
We recommend following the tutorial to learn more about how to use Kani.
Kani contains code from the Rust project.
Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.