Skip to content

Commit a91e021

Browse files
committed
fix: restore tests accidentally deleted
1 parent 24869fd commit a91e021

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//@check-pass
2+
//@compile-flags: -Adead_code -C debug-assertions=off
3+
4+
#![feature(custom_inner_attributes)]
5+
#![thrust::raw_command("(define-fun is_double ((x Int) (doubled_x Int)) Bool
6+
(=
7+
(* x 2)
8+
doubled_x
9+
)
10+
)")]
11+
12+
#[thrust::requires(true)]
13+
#[thrust::ensures(is_double(x, result))]
14+
fn double(x: i64) -> i64 {
15+
x + x
16+
}
17+
18+
fn main() {
19+
let a = 3;
20+
assert!(double(a) == 6);
21+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//@check-pass
2+
//@compile-flags: -Adead_code -C debug-assertions=off
3+
4+
#![feature(custom_inner_attributes)]
5+
#![thrust::raw_command("(define-fun is_double ((x Int) (doubled_x Int)) Bool
6+
(=
7+
(* x 2)
8+
doubled_x
9+
)
10+
)")]
11+
12+
#![thrust::raw_command("(define-fun is_triple ((x Int) (tripled_x Int)) Bool
13+
(=
14+
(* x 3)
15+
tripled_x
16+
)
17+
)")]
18+
19+
#[thrust::requires(true)]
20+
#[thrust::ensures(is_double(x, result))]
21+
fn double(x: i64) -> i64 {
22+
x + x
23+
}
24+
25+
#[thrust::require(is_double(x, doubled_x))]
26+
#[thrust::ensures(is_triple(x, result))]
27+
fn triple(x: i64, doubled_x: i64) -> i64 {
28+
x + doubled_x
29+
}
30+
31+
fn main() {
32+
let a = 3;
33+
let double_a = double(a);
34+
assert!(double_a == 6);
35+
assert!(triple(a, double_a) == 9);
36+
}

0 commit comments

Comments
 (0)