Skip to content

Commit

Permalink
Add test from issue #1286
Browse files Browse the repository at this point in the history
  • Loading branch information
fpoli authored Feb 2, 2023
1 parent 90373f1 commit 3dd957c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions prusti-tests/tests/verify_overflow/pass/generic/increasing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use prusti_contracts::*;

#[extern_spec]
impl PartialOrd<i32> for i32{
#[pure]
#[ensures(result == (*self < *other))]
fn lt(&self, other: &i32) -> bool;
}

predicate! {
fn increasing<T: PartialOrd>(s: &[T]) -> bool {
forall(|i: usize, j: usize|
(i < j && j < s.len() ==> s[i] < s[j]))
}
}

fn test() {
let x = [1, 2, 3];
prusti_assert!(increasing(&x));
}

fn main() {}

0 comments on commit 3dd957c

Please sign in to comment.