mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 10:22:19 +00:00
Add tests.
This commit is contained in:
parent
25034ece07
commit
c6dfbcd90d
12
examples/single_pass_tests/call_indirect.wat
Normal file
12
examples/single_pass_tests/call_indirect.wat
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
(module
|
||||||
|
(type $binop (func (param i32 i32) (result i32)))
|
||||||
|
(table 1 100 anyfunc)
|
||||||
|
(elem (i32.const 10) $add)
|
||||||
|
|
||||||
|
(func $main (export "main") (result i32)
|
||||||
|
(call_indirect (type $binop) (i32.const 42) (i32.const 1) (i32.const 9))
|
||||||
|
)
|
||||||
|
(func $add (param i32) (param i32) (result i32)
|
||||||
|
(i32.add (get_local 0) (get_local 1))
|
||||||
|
)
|
||||||
|
)
|
26
examples/single_pass_tests/global.wat
Normal file
26
examples/single_pass_tests/global.wat
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
(module
|
||||||
|
(global $g1 (mut i32) (i32.const 0))
|
||||||
|
(global $g2 (mut i32) (i32.const 99))
|
||||||
|
(func $main (export "main")
|
||||||
|
(if (i32.eq (get_global $g1) (i32.const 0))
|
||||||
|
(then)
|
||||||
|
(else unreachable)
|
||||||
|
)
|
||||||
|
(if (i32.eq (get_global $g2) (i32.const 99))
|
||||||
|
(then)
|
||||||
|
(else unreachable)
|
||||||
|
)
|
||||||
|
|
||||||
|
(set_global $g1 (i32.add (get_global $g1) (i32.const 1)))
|
||||||
|
(set_global $g2 (i32.sub (get_global $g2) (i32.const 1)))
|
||||||
|
|
||||||
|
(if (i32.eq (get_global $g1) (i32.const 1))
|
||||||
|
(then)
|
||||||
|
(else unreachable)
|
||||||
|
)
|
||||||
|
(if (i32.eq (get_global $g2) (i32.const 98))
|
||||||
|
(then)
|
||||||
|
(else unreachable)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user