forked from model-checking/kani
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2051b7
commit 042eb47
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
| | ||
| #[kani::requires(a + b)] | ||
| -----------------^^^^^-- | ||
| | | | ||
| | expected `bool`, found `u64` | ||
| arguments to this function are incorrect | ||
| | ||
|
||
| | ||
| #[kani::ensures(|result| a % *result && b % *result == 0 && *result != 0)] | ||
| ^^^^^^^^^^^ expected `bool`, found `u64` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// kani-flags: -Zfunction-contracts | ||
|
||
// This tests that Kani reports the "ideal" error message when contracts are non-boolean expressions | ||
// By "ideal," we mean that the error spans are as narrow as possible | ||
// (c.f. https://github.com/model-checking/kani/issues/3009) | ||
|
||
#[kani::requires(a + b)] | ||
#[kani::ensures(|result| a % *result && b % *result == 0 && *result != 0)] | ||
fn gcd(a: u64, b: u64) -> u64 { | ||
0 | ||
} |