]> git.proxmox.com Git - rustc.git/blob - src/binaryen/test/spec/forward.wast
New upstream version 1.25.0+dfsg1
[rustc.git] / src / binaryen / test / spec / forward.wast
1 (module
2 (func $even (export "even") (param $n i32) (result i32)
3 (if i32 (i32.eq (get_local $n) (i32.const 0))
4 (i32.const 1)
5 (call $odd (i32.sub (get_local $n) (i32.const 1)))
6 )
7 )
8
9 (func $odd (export "odd") (param $n i32) (result i32)
10 (if i32 (i32.eq (get_local $n) (i32.const 0))
11 (i32.const 0)
12 (call $even (i32.sub (get_local $n) (i32.const 1)))
13 )
14 )
15 )
16
17 (assert_return (invoke "even" (i32.const 13)) (i32.const 0))
18 (assert_return (invoke "even" (i32.const 20)) (i32.const 1))
19 (assert_return (invoke "odd" (i32.const 13)) (i32.const 1))
20 (assert_return (invoke "odd" (i32.const 20)) (i32.const 0))