commit afcaba92e3a1bb84fe7699d8d3d55d1362f323e0
parent e42994f98ba262fb6d6d7bfdf27b4e0bcbd7fca6
Author: William Casarin <jb55@jb55.com>
Date: Sun, 1 Aug 2021 09:33:42 -0700
more test cases
Diffstat:
9 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/wasm/test/hello.c.wasm b/wasm/test/hello.c.wasm
Binary files differ.
diff --git a/wasm/test/hello.wasm.c b/wasm/test/hello.wasm.c
@@ -0,0 +1,13 @@
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+int main(int argc, const char *argv[])
+{
+ printf("1%d\n", 0);
+
+ return 0;
+}
+
+
diff --git a/wasm/test/ifelse.wasm b/wasm/test/ifelse.wasm
Binary files differ.
diff --git a/wasm/test/ifelse.wat b/wasm/test/ifelse.wat
@@ -1,4 +1,5 @@
(module
+ (memory $mem 0)
(func $add (param $lhs i32) (param $rhs i32) (result i32)
local.get $lhs
local.get $rhs
@@ -8,7 +9,7 @@
local.get $rhs
i32.sub
)
- (func $start (result i32)
+ (func $start
(local i32 i32)
i32.const 0
local.set 0
@@ -35,8 +36,8 @@
end
end
end
- i32.const 0
)
(export "_start" (func $start))
(export "add" (func $add))
+ (export "memory" (memory $mem))
(export "sub" (func $sub)))
diff --git a/wasm/test/ifelse2.wasm b/wasm/test/ifelse2.wasm
Binary files differ.
diff --git a/wasm/test/ifelse3.wasm b/wasm/test/ifelse3.wasm
Binary files differ.
diff --git a/wasm/test/ifelse3.wat b/wasm/test/ifelse3.wat
@@ -0,0 +1,31 @@
+(module
+ (func $add (param $lhs i32) (param $rhs i32) (result i32)
+ local.get $lhs
+ local.get $rhs
+ i32.add)
+ (func $sub (param $lhs i32) (param $rhs i32) (result i32)
+ local.get $lhs
+ local.get $rhs
+ i32.sub
+ )
+ (func $start (result i32)
+ (local i32 i32)
+ i32.const 0
+ (if (result i32)
+ (then
+ i32.const 2
+ local.get 0
+ i32.sub
+ i32.const 0
+ i32.lt_s)
+ (else
+ i32.const 0))
+ if
+ unreachable
+ end
+ i32.const 0
+ )
+ (export "_start" (func $start))
+ (export "add" (func $add))
+ (export "sub" (func $sub)))
+
diff --git a/wasm/test/ifelse4.wasm b/wasm/test/ifelse4.wasm
Binary files differ.
diff --git a/wasm/test/ifelse4.wat b/wasm/test/ifelse4.wat
@@ -0,0 +1,31 @@
+(module
+ (func $add (param $lhs i32) (param $rhs i32) (result i32)
+ local.get $lhs
+ local.get $rhs
+ i32.add)
+ (func $sub (param $lhs i32) (param $rhs i32) (result i32)
+ local.get $lhs
+ local.get $rhs
+ i32.sub
+ )
+ (func $start (result i32)
+ (local i32 i32)
+ i32.const 1
+ (if (result i32)
+ (then
+ i32.const 2
+ local.get 0
+ i32.sub
+ i32.const 0
+ i32.lt_s)
+ (else
+ unreachable))
+ if
+ unreachable
+ end
+ i32.const 0
+ )
+ (export "_start" (func $start))
+ (export "add" (func $add))
+ (export "sub" (func $sub)))
+