From fd3856fc6531043df2d141cf0072494d19870b4f Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 22 Jul 2022 15:47:32 +0200 Subject: [PATCH] Added a simple divide by zero trap wast test (for #1899) --- tests/wast/wasmer/README.md | 6 +++++- tests/wast/wasmer/divide.wast | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tests/wast/wasmer/divide.wast diff --git a/tests/wast/wasmer/README.md b/tests/wast/wasmer/README.md index 976146c247b..60c933dfb2c 100644 --- a/tests/wast/wasmer/README.md +++ b/tests/wast/wasmer/README.md @@ -7,7 +7,7 @@ by the standard WebAssembly spectests. ## NaN canonicalization: `nan-canonicalization.wast` This is an extra set of tests that assure that operations with NaNs -are deterministic regarless of the environment/chipset where it executes in. +are deterministic regardless of the environment/chipset where it executes in. ## Call Indirect Spilled Stack: `call-indirect-spilledd-stack.wast` @@ -28,3 +28,7 @@ This is a simple factorial program. Stack space for a structure returning function call should be allocated once up front, not once in each call. + +## Divide by Zero: `divide.wast` + +This is a simple test to check that a divide by zero is correctly trapped \ No newline at end of file diff --git a/tests/wast/wasmer/divide.wast b/tests/wast/wasmer/divide.wast new file mode 100644 index 00000000000..92258df5516 --- /dev/null +++ b/tests/wast/wasmer/divide.wast @@ -0,0 +1,4 @@ +(module + (func (export "div_s") (param $x i64) (param $y i64) (result i64) (i64.div_s (local.get $x) (local.get $y))) +) +(assert_trap (invoke "div_s" (i64.const 1) (i64.const 0)) "integer divide by zero")