From 411267673d072875032c5ed72e788bccadecc98d Mon Sep 17 00:00:00 2001 From: Graham Kelly Date: Sat, 20 Jan 2024 11:37:12 -0500 Subject: [PATCH] tests --- test.sh | 3 +++ wasm_tests/test4.wat | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 test.sh create mode 100644 wasm_tests/test4.wat diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..244c620 --- /dev/null +++ b/test.sh @@ -0,0 +1,3 @@ +wat2wasm --enable-tail-call $1 -o $1.wasm +cargo run roundtrip -i $1.wasm -o $1.rt.wasm +wasm2wat --enable-tail-call $1.rt.wasm \ No newline at end of file diff --git a/wasm_tests/test4.wat b/wasm_tests/test4.wat new file mode 100644 index 0000000..9026ed8 --- /dev/null +++ b/wasm_tests/test4.wat @@ -0,0 +1,7 @@ +(module + (func $a (param i32) (param i32) (result i32) + (local $diff i32) + (local.set $diff (i32.const 1)) + (if (i32.eqz (local.get 0)) (return (local.get 1))) + (return_call $a (i32.sub (local.get 0) (local.get $diff)) (i32.add (local.get 1) (local.get $diff))) + ))