summaryrefslogtreecommitdiff
path: root/test/wasm2asm.wast.asserts
diff options
context:
space:
mode:
authorThomas Lively <tlively@users.noreply.github.com>2017-08-16 15:01:56 -0700
committerAlon Zakai <alonzakai@gmail.com>2017-08-16 15:01:56 -0700
commit5fafb87a2819cebd94941c77c07ebe067471eb7d (patch)
tree232edd6e144a43094bf2127a6a6e4913a5674884 /test/wasm2asm.wast.asserts
parent21d06aea04244fa71b5053bd87f2ec6a2ac9d5c2 (diff)
downloadbinaryen-5fafb87a2819cebd94941c77c07ebe067471eb7d.tar.gz
binaryen-5fafb87a2819cebd94941c77c07ebe067471eb7d.tar.bz2
binaryen-5fafb87a2819cebd94941c77c07ebe067471eb7d.zip
wasm2asm test generation (#1124)
* Translate assert_return invokes to asm * Translate assert_trap tests to JS * Enable wasm2asm tests * Fix wasm2asm translation of store * Update ubuntu nodejs in Travis * Free JSPrinter buffer * Use unique_ptr for Functions to prevent leaks * Add tests for assert translation
Diffstat (limited to 'test/wasm2asm.wast.asserts')
-rw-r--r--test/wasm2asm.wast.asserts10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/wasm2asm.wast.asserts b/test/wasm2asm.wast.asserts
new file mode 100644
index 000000000..ea6ab4871
--- /dev/null
+++ b/test/wasm2asm.wast.asserts
@@ -0,0 +1,10 @@
+;; i32 operations
+
+(module
+ (func (export "add") (param $x i32) (param $y i32) (result i32) (i32.add (get_local $x) (get_local $y)))
+ (func (export "div_s") (param $x i32) (param $y i32) (result i32) (i32.div_s (get_local $x) (get_local $y)))
+)
+
+(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")