Something went wrong. Try again.
forked from verus-lang/verus
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950// rust_verify/tests/example.rs#[allow(unused_imports)]use verus_builtin::*;#[allow(unused_imports)]use verus_builtin_macros::*;use vstd::prelude::*;
verus! {
/*// ANCHOR: compute_sum_failsfn compute_sum_fails(x: u64, y: u64) -> (result: u64) ensures result == x + y,{ x + y // error: possible arithmetic underflow/overflow}// ANCHOR_END: compute_sum_fails*/
// ANCHOR: compute_sum_limitedfn compute_sum_limited(x: u64, y: u64) -> (result: u64) requires x < 1000000, y < 1000000, ensures result == x + y,{ x + y}// ANCHOR_END: compute_sum_limited
// ANCHOR: compute_sum_runtime_checkfn compute_sum_runtime_check(x: u64, y: u64) -> (result: Option<u64>) ensures match result { Some(z) => z == x + y, None => x + y > u64::MAX, },{ x.checked_add(y)}// ANCHOR: compute_sum_runtime_check
fn main() {}
} // verus!