From bb99e3873d17d432d8898f0722eab17b75bae446 Mon Sep 17 00:00:00 2001 From: Zhicheng HUI Date: Tue, 17 Sep 2024 10:30:52 +0200 Subject: [PATCH] add assert.wat in test --- src/ast/code_generator.ml | 7 ++----- test/weasel/assert.t | 1 + test/weasel/assert.wat | 8 ++++++++ test/weasel/dune | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 test/weasel/assert.t create mode 100644 test/weasel/assert.wat diff --git a/src/ast/code_generator.ml b/src/ast/code_generator.ml index 185f4750..b2c3ade7 100644 --- a/src/ast/code_generator.ml +++ b/src/ast/code_generator.ml @@ -686,11 +686,8 @@ let add_owi_funcs (owi_funcs : (string * binary func_type) array) (m : modul) : in update_func () -let generate (symbolic : bool) (m : modul) : modul Result.t = - let owi_funcs = - if symbolic then [| ("assert", ([ (None, Num_type I32) ], [])) |] - else [| ("assert", ([ (None, Num_type I32) ], [])) |] - in +let generate (_symbolic : bool) (m : modul) : modul Result.t = + let owi_funcs = [| ("assert", ([ (None, Num_type I32) ], [])) |] in let m, owi_funcs = add_owi_funcs owi_funcs m in contracts_generate owi_funcs m (List.filter_map diff --git a/test/weasel/assert.t b/test/weasel/assert.t new file mode 100644 index 00000000..a9cf4050 --- /dev/null +++ b/test/weasel/assert.t @@ -0,0 +1 @@ + $ owi run --rac ./assert.wat diff --git a/test/weasel/assert.wat b/test/weasel/assert.wat new file mode 100644 index 00000000..748b78e4 --- /dev/null +++ b/test/weasel/assert.wat @@ -0,0 +1,8 @@ +(module + (@contract $start + (requires (= 2 (+ 1 1))) + ) + (func $start + ) + (start $start) +) diff --git a/test/weasel/dune b/test/weasel/dune index d929f155..b1a73d7a 100644 --- a/test/weasel/dune +++ b/test/weasel/dune @@ -1,2 +1,2 @@ (cram - (deps %{bin:owi} forall.wat plus.wat sum.wat)) + (deps %{bin:owi} assert.wat forall.wat plus.wat sum.wat))