...

Text file src/github.com/tetratelabs/wazero/internal/integration_test/spectest/v1/testdata/forward.wast

Documentation: github.com/tetratelabs/wazero/internal/integration_test/spectest/v1/testdata

     1(module
     2  (func $even (export "even") (param $n i32) (result i32)
     3    (if (result i32) (i32.eq (local.get $n) (i32.const 0))
     4      (then (i32.const 1))
     5      (else (call $odd (i32.sub (local.get $n) (i32.const 1))))
     6    )
     7  )
     8
     9  (func $odd (export "odd") (param $n i32) (result i32)
    10    (if (result i32) (i32.eq (local.get $n) (i32.const 0))
    11      (then (i32.const 0))
    12      (else (call $even (i32.sub (local.get $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))

View as plain text