File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments