Skip to content

Commit

Permalink
Fix verifier error
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianJendo committed Apr 11, 2024
1 parent 3b7e6c0 commit 6ec8437
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/rust-jobs/mock-test1/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ fn test<T: Test>(mock_test: &T, x: i32, y: bool) -> i32 {
#[no_mangle]
pub extern "C" fn entrypt() {
let mut mock: MockTest = MockTest::new();
let mut x: i32 = verifier::any!();
let mut y: bool = verifier::any!();
let x: i32 = verifier::any!();
let y: bool = verifier::any!();

verifier::assume!(x < 10);

mock
.times_a(2)
.times_b(2)
.times_c(1)
.returning_a(|x, y| x + 5)
.returning_a(|x, _y| x + 5)
.returning_b(|| 4);

verifier::vassert!(mock.a(x, y) < 15);
Expand Down
2 changes: 1 addition & 1 deletion src/sea_cex_base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ verify_options:
'-S': ''
# keep intermediate results for debugging
keep-temps: ''
temp-dir: /tmp/c-rust-sid
temp-dir: /tmp/ajendo
# time and result stats
horn-stats: true
# produce counterexample harness
Expand Down
5 changes: 1 addition & 4 deletions src/seamock-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,12 @@ pub fn seamock(_args: TokenStream, input: TokenStream) -> TokenStream {

let times_attr = Ident::new(&format!("times_{}", &method.sig.ident), method.sig.ident.span());
let max_times_attr = Ident::new(&format!("max_times_{}", &method.sig.ident), method.sig.ident.span());
let val_attr = Ident::new(&format!("val_with_{}", &method.sig.ident), method.sig.ident.span());
let ret_func = Ident::new(&format!("val_returning_{}", &method.sig.ident), method.sig.ident.span());
let method_name_string = &method.sig.ident.to_string();

Some (quote! {
fn #method_name(#method_inputs) #method_output {
self.#times_attr.replace_with(|&mut old| old + 1);
// verifier::vassert!(*self.#times_attr.borrow() <= self.#max_times_attr)
verifier::vassert!(*self.#times_attr.borrow() <= self.#max_times_attr);
(self.#ret_func)(#(#params)*)
}
})
Expand Down Expand Up @@ -206,7 +204,6 @@ pub fn seamock(_args: TokenStream, input: TokenStream) -> TokenStream {
#(#with_methods)*
#(#times_methods)*
#(#expect_times_methods)*
// #(#methods_impl)*
}
};

Expand Down

0 comments on commit 6ec8437

Please sign in to comment.