Skip to content

Commit

Permalink
Merge pull request #544 from Aurel300/reenable-tests
Browse files Browse the repository at this point in the history
Reenable some passing tests from `tests_old`
  • Loading branch information
Aurel300 authored Jun 10, 2021
2 parents 05fdbe5 + 8e51ec4 commit fba3f6f
Show file tree
Hide file tree
Showing 35 changed files with 76 additions and 321 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct List {
}

#[pure]
fn lookup(head: &List, index: isize) -> u32 {
fn lookup(head: &List, index: usize) -> u32 {
if index == 0 {
head.value
} else {
Expand All @@ -24,7 +24,7 @@ fn lookup(head: &List, index: isize) -> u32 {
}

#[pure]
fn len(head: &List) -> isize {
fn len(head: &List) -> usize {
match head.next {
None => 1,
Some(box ref tail) => 1 + len(tail)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


use prusti_contracts::*;

#[derive(Clone,Copy,PartialEq,Eq)]
Expand All @@ -19,6 +17,4 @@ fn first(_x: A, _y: A) -> A {
_x
}

fn main() {
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


use prusti_contracts::*;

#[derive(Clone,Copy,PartialEq,Eq)]
Expand All @@ -19,6 +17,4 @@ fn first(_x: A, _y: A) -> A {
_x
}

fn main() {
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


use prusti_contracts::*;

#[derive(Clone,Copy,PartialEq,Eq)]
Expand All @@ -19,6 +17,4 @@ fn first(_x: A, _y: A) -> A {
_x
}

fn main() {
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


use prusti_contracts::*;

#[derive(Clone,Copy,PartialEq,Eq)]
Expand All @@ -19,6 +17,4 @@ fn first(_x: A, _y: A) -> A {
_x
}

fn main() {
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


use prusti_contracts::*;

#[derive(Clone,Copy,PartialEq,Eq)]
Expand All @@ -19,7 +17,4 @@ fn foo(x: A) -> A {
x
}


fn main() {
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


use prusti_contracts::*;

#[derive(Clone,Copy,PartialEq,Eq)]
Expand All @@ -19,6 +17,4 @@ fn first(_x: A, _y: A) -> A {
_x
}

fn main() {
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


use prusti_contracts::*;

#[derive(Clone,Copy,PartialEq,Eq)]
Expand All @@ -18,6 +16,4 @@ fn first(_x: A, _y: A) -> A {
_x
}

fn main() {
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


use prusti_contracts::*;

#[derive(Clone,Copy,PartialEq,Eq)]
Expand All @@ -18,6 +16,4 @@ fn first(_x: A, _y: A) -> A {
_x
}

fn main() {
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


use prusti_contracts::*;

#[derive(Clone,Copy,PartialEq,Eq)]
Expand All @@ -18,6 +16,4 @@ fn first(_x: A, _y: A) -> A {
_x
}

fn main() {
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extern crate prusti_contracts;
use prusti_contracts::*;

trait Percentage {
#[requires(arg <= 100)]
Expand Down
3 changes: 0 additions & 3 deletions prusti-tests/tests/verify/pass/extern-spec/traits-3.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
extern crate prusti_contracts;
use prusti_contracts::*;

// ignore-test This fails when encoding the postcondition of the trait method.

pub trait Trait {
#[ensures(result == 3)]
fn foo(&mut self) -> i32 { 3 }
}

Expand Down
2 changes: 1 addition & 1 deletion prusti-tests/tests/verify/pass/extern-spec/traits-5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ impl PrustiStructstdcloneClone12e4123 {
}
}

fn main() {}
fn main() {}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use prusti_contracts::*;

#[derive(Eq, PartialEq)]
pub struct T {
val: u32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ use std::cmp::Ordering;
use std::collections::BinaryHeap;
use std::usize;


struct VecWrapperNode{}
struct VecWrapperNode {}

impl VecWrapperNode {
#[pure]
Expand All @@ -23,7 +22,7 @@ struct Grid {
}

impl Grid {
fn find_path(&mut self){
fn find_path(&mut self) {
while true {
body_invariant!(self.nodes.len() >= 0);
}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
#![feature(register_tool)]
#![register_tool(prusti)]
#[prelude_import]
use std::prelude::v1::*;
use std::prelude::rust_2018::*;
#[macro_use]
extern crate std;
use prusti_contracts::*;
#[allow(unused_must_use, unused_variables, dead_code)]
#[prusti::spec_only]
#[prusti::spec_id = "$(NUM_UUID)"]
#[prusti::assertion =
Expand All @@ -26,6 +27,7 @@ fn prusti_pre_item_test1_$(NUM_UUID)() {
}
#[prusti::pre_spec_id_ref = "$(NUM_UUID)"]
fn test1() { }
#[allow(unused_must_use, unused_variables, dead_code)]
#[prusti::spec_only]
#[prusti::spec_id = "$(NUM_UUID)"]
#[prusti::assertion =
Expand All @@ -41,25 +43,32 @@ fn test2() { }
fn test3() {
let mut curr = 0;
while curr < 2 {

#[allow(unused_must_use, unused_variables)]
if false {

#[prusti::spec_only]
#[prusti::loop_body_invariant_spec]
#[prusti::spec_id = "$(NUM_UUID)"]
#[prusti::assertion =
"{/"kind/":{/"Expr/":{/"spec_id/":/"$(UUID)/",/"expr_id/":101}}}"]
||
{

#[prusti::spec_only]
#[prusti::expr_id =
"$(NUM_UUID)_101"]
|| -> bool { true };
};
#[allow(unused_must_use, unused_variables)]
{

#[prusti::spec_only]
#[prusti::loop_body_invariant_spec]
#[prusti::spec_id = "$(NUM_UUID)"]
#[prusti::assertion =
"{/"kind/":{/"Expr/":{/"spec_id/":/"$(UUID)/",/"expr_id/":101}}}"]
||
{

#[prusti::spec_only]
#[prusti::expr_id =
"$(NUM_UUID)_101"]
|| -> bool { true };
};
}
};
curr += 1;
}
}
#[allow(unused_must_use, unused_variables, dead_code)]
#[prusti::spec_only]
#[prusti::spec_id = "$(NUM_UUID)"]
#[prusti::assertion =
Expand All @@ -70,6 +79,7 @@ fn prusti_pre_item_test4_$(NUM_UUID)() {
#[prusti::expr_id = "$(NUM_UUID)_101"]
|| -> bool { true };
}
#[allow(unused_must_use, unused_variables, dead_code)]
#[prusti::spec_only]
#[prusti::spec_id = "$(NUM_UUID)"]
#[prusti::assertion =
Expand All @@ -85,28 +95,35 @@ fn prusti_post_item_test4_$(NUM_UUID)(result: ()) {
fn test4() {
let mut curr = 0;
while curr < 2 {

#[allow(unused_must_use, unused_variables)]
if false {

#[prusti::spec_only]
#[prusti::loop_body_invariant_spec]
#[prusti::spec_id = "$(NUM_UUID)"]
#[prusti::assertion =
"{/"kind/":{/"Expr/":{/"spec_id/":/"$(UUID)/",/"expr_id/":101}}}"]
{

#[prusti::spec_only]
#[prusti::expr_id =
"$(NUM_UUID)_101"]
|| -> bool { true };
};
#[allow(unused_must_use, unused_variables)]
{

#[prusti::spec_only]
#[prusti::loop_body_invariant_spec]
#[prusti::spec_id = "$(NUM_UUID)"]
#[prusti::assertion =
"{/"kind/":{/"Expr/":{/"spec_id/":/"$(UUID)/",/"expr_id/":101}}}"]
||
{

#[prusti::spec_only]
#[prusti::expr_id =
"$(NUM_UUID)_101"]
|| -> bool { true };
};
}
};
curr += 1;
}
}
fn main() { }
Collected verification items 5:
procedure: collect::test3[0] at $DIR/collect.rs:13:1: 13:11 (#0)
procedure: collect::main[0] at $DIR/collect.rs:31:1: 31:10 (#0)
procedure: collect::test1[0] at $DIR/collect.rs:8:1: 8:11 (#0)
procedure: collect::test2[0] at $DIR/collect.rs:11:1: 11:11 (#0)
procedure: collect::test4[0] at $DIR/collect.rs:23:1: 23:11 (#0)
procedure: collect::test3 at $DIR/collect.rs:13:1: 13:11 (#0)
procedure: collect::main at $DIR/collect.rs:31:1: 31:10 (#0)
procedure: collect::test1 at $DIR/collect.rs:8:1: 8:11 (#0)
procedure: collect::test2 at $DIR/collect.rs:11:1: 11:11 (#0)
procedure: collect::test4 at $DIR/collect.rs:23:1: 23:11 (#0)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ note: the error originates here
| |_^

error: [Prusti: verification error] loop invariant might not hold in the first loop iteration.
--> $DIR/failures.rs:22:17
--> $DIR/failures.rs:23:25
|
22 | #[invariant(false)]
| ^^^^^
23 | body_invariant!(false);
| ^^^^^
|
note: the error originates here
--> $DIR/failures.rs:22:17
--> $DIR/failures.rs:23:25
|
22 | #[invariant(false)]
| ^^^^^
23 | body_invariant!(false);
| ^^^^^

error: [Prusti: verification error] precondition might not hold.
--> $DIR/failures.rs:29:5
Expand Down
4 changes: 2 additions & 2 deletions prusti-tests/tests_old/verify/fail/marker-traits/basic.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use prusti_contracts::*;

#[invariant(self.d1 > 5)] //~ ERROR mismatched types
trait Foo { }
trait Foo {}

struct Dummy {
d1: bool
}

impl Foo for Dummy {}

fn main() { }
fn main() {}
5 changes: 0 additions & 5 deletions prusti-tests/tests_old/verify/pass/equality/pure-first-arg.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


use prusti_contracts::*;

#[derive(Clone,Copy,PartialEq,Eq)]
Expand All @@ -13,11 +11,8 @@ fn get_value(_x: A, _y: A) -> A {
}

fn main() {

let _a = A { i: 17 };
let _b = A { i: 19 };
let _x = get_value(_a, _b);

assert!(_x == _a);
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


use prusti_contracts::*;

#[derive(Clone,Copy,PartialEq,Eq)]
Expand All @@ -18,4 +16,3 @@ fn main() {
let _z = get_value(_x);
assert!(_y == _z);
}

Loading

0 comments on commit fba3f6f

Please sign in to comment.