summaryrefslogtreecommitdiff
path: root/test/wasm2js/wasm2js.wast.asserts
blob: 53d6a47ad20473238a1b646910eb65c434bedf34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
;; i32 operations

(module
  (func (export "empty"))
  (func (export "add") (param $x i32) (param $y i32) (result i32) (i32.add (local.get $x) (local.get $y)))
  (func (export "div_s") (param $x i32) (param $y i32) (result i32) (i32.div_s (local.get $x) (local.get $y)))
)

(assert_return (invoke "empty"))
(assert_return (invoke "add" (i32.const 1) (i32.const 1)) (i32.const 2))
(assert_trap (invoke "div_s" (i32.const 0) (i32.const 0)) "integer divide by zero")
(assert_trap (invoke "div_s" (i32.const 0x80000000) (i32.const -1)) "integer overflow")