forked from GitHub/haskell-wasm
update tests from core repo
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
)
|
||||
(assert_invalid
|
||||
(module (memory 0) (func (drop (i64.load align=16 (i32.const 0)))))
|
||||
"alignment must not be larger than natural"
|
||||
"alignment"
|
||||
)
|
||||
|
||||
(assert_malformed
|
||||
@@ -29,5 +29,5 @@
|
||||
)
|
||||
(assert_invalid
|
||||
(module (memory 0) (func (i64.store align=16 (i32.const 0) (i64.const 0))))
|
||||
"alignment must not be larger than natural"
|
||||
"alignment"
|
||||
)
|
||||
|
||||
@@ -287,7 +287,7 @@
|
||||
"zero flag expected"
|
||||
)
|
||||
|
||||
;; grow_memory reserved byte equal to zero.
|
||||
;; memory.grow reserved byte equal to zero.
|
||||
(assert_malformed
|
||||
(module binary
|
||||
"\00asm" "\01\00\00\00"
|
||||
@@ -299,15 +299,15 @@
|
||||
;; function 0
|
||||
"\07\00"
|
||||
"\41\00" ;; i32.const 0
|
||||
"\40" ;; grow_memory
|
||||
"\01" ;; grow_memory reserved byte is not equal to zero!
|
||||
"\40" ;; memory.grow
|
||||
"\01" ;; memory.grow reserved byte is not equal to zero!
|
||||
"\1a" ;; drop
|
||||
"\0b" ;; end
|
||||
)
|
||||
"zero flag expected"
|
||||
)
|
||||
|
||||
;; current_memory reserved byte equal to zero.
|
||||
;; memory.size reserved byte equal to zero.
|
||||
(assert_malformed
|
||||
(module binary
|
||||
"\00asm" "\01\00\00\00"
|
||||
@@ -318,8 +318,8 @@
|
||||
|
||||
;; function 0
|
||||
"\05\00"
|
||||
"\3f" ;; current_memory
|
||||
"\01" ;; current_memory reserved byte is not equal to zero!
|
||||
"\3f" ;; memory.size
|
||||
"\01" ;; memory.size reserved byte is not equal to zero!
|
||||
"\1a" ;; drop
|
||||
"\0b" ;; end
|
||||
)
|
||||
|
||||
@@ -238,8 +238,8 @@
|
||||
(block (result i32) (i32.wrap/i64 (br 0 (i32.const 41))))
|
||||
)
|
||||
|
||||
(func (export "as-grow_memory-size") (result i32)
|
||||
(block (result i32) (grow_memory (br 0 (i32.const 40))))
|
||||
(func (export "as-memory.grow-size") (result i32)
|
||||
(block (result i32) (memory.grow (br 0 (i32.const 40))))
|
||||
)
|
||||
|
||||
(func (export "nested-block-value") (result i32)
|
||||
@@ -398,7 +398,7 @@
|
||||
|
||||
(assert_return (invoke "as-convert-operand") (i32.const 41))
|
||||
|
||||
(assert_return (invoke "as-grow_memory-size") (i32.const 40))
|
||||
(assert_return (invoke "as-memory.grow-size") (i32.const 40))
|
||||
|
||||
(assert_return (invoke "nested-block-value") (i32.const 9))
|
||||
(assert_return (invoke "nested-br-value") (i32.const 9))
|
||||
|
||||
@@ -1098,8 +1098,8 @@
|
||||
)
|
||||
)
|
||||
|
||||
(func (export "as-grow_memory-size") (result i32)
|
||||
(block (result i32) (grow_memory (br_table 0 (i32.const 40) (i32.const 0))))
|
||||
(func (export "as-memory.grow-size") (result i32)
|
||||
(block (result i32) (memory.grow (br_table 0 (i32.const 40) (i32.const 0))))
|
||||
)
|
||||
|
||||
(func (export "nested-block-value") (param i32) (result i32)
|
||||
@@ -1363,7 +1363,7 @@
|
||||
|
||||
(assert_return (invoke "as-convert-operand") (i32.const 41))
|
||||
|
||||
(assert_return (invoke "as-grow_memory-size") (i32.const 40))
|
||||
(assert_return (invoke "as-memory.grow-size") (i32.const 40))
|
||||
|
||||
(assert_return (invoke "nested-block-value" (i32.const 0)) (i32.const 19))
|
||||
(assert_return (invoke "nested-block-value" (i32.const 1)) (i32.const 17))
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
;; (func (import "spectest" "print_i64") (param i64))
|
||||
(import "spectest" "print_i32" (func $print_i32 (param i32)))
|
||||
;; JavaScript can't handle i64 yet.
|
||||
(import "spectest" "print_i64" (func $print_i64 (param i64)))
|
||||
;; (import "spectest" "print_i64" (func $print_i64 (param i64)))
|
||||
(import "spectest" "print_f32" (func $print_f32 (param f32)))
|
||||
(import "spectest" "print_f64" (func $print_f64 (param f64)))
|
||||
(import "spectest" "print_i32_f32" (func $print_i32_f32 (param i32 f32)))
|
||||
@@ -87,6 +87,14 @@
|
||||
(assert_return (invoke "print32" (i32.const 13)))
|
||||
(assert_return (invoke "print64" (i64.const 24)))
|
||||
|
||||
(assert_invalid
|
||||
(module
|
||||
(type (func (result i32)))
|
||||
(import "test" "func" (func (type 1)))
|
||||
)
|
||||
"unknown type"
|
||||
)
|
||||
|
||||
(module (import "test" "func" (func)))
|
||||
(module (import "test" "func-i32" (func (param i32))))
|
||||
(module (import "test" "func-f32" (func (param f32))))
|
||||
@@ -478,7 +486,7 @@
|
||||
|
||||
(module
|
||||
(import "spectest" "memory" (memory 0 3)) ;; actual has max size 2
|
||||
(func (export "grow") (param i32) (result i32) (grow_memory (get_local 0)))
|
||||
(func (export "grow") (param i32) (result i32) (memory.grow (get_local 0)))
|
||||
)
|
||||
(assert_return (invoke "grow" (i32.const 0)) (i32.const 1))
|
||||
(assert_return (invoke "grow" (i32.const 1)) (i32.const 1))
|
||||
|
||||
@@ -274,7 +274,7 @@
|
||||
(memory (import "Mm" "mem") 1 8)
|
||||
|
||||
(func (export "grow") (param $a i32) (result i32)
|
||||
(grow_memory (get_local 0))
|
||||
(memory.grow (get_local 0))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
(assert_invalid (module (memory 0) (memory 0)) "multiple memories")
|
||||
(assert_invalid (module (memory (import "spectest" "memory") 0) (memory 0)) "multiple memories")
|
||||
|
||||
(module (memory (data)) (func (export "memsize") (result i32) (current_memory)))
|
||||
(module (memory (data)) (func (export "memsize") (result i32) (memory.size)))
|
||||
(assert_return (invoke "memsize") (i32.const 0))
|
||||
(module (memory (data "")) (func (export "memsize") (result i32) (current_memory)))
|
||||
(module (memory (data "")) (func (export "memsize") (result i32) (memory.size)))
|
||||
(assert_return (invoke "memsize") (i32.const 0))
|
||||
(module (memory (data "x")) (func (export "memsize") (result i32) (current_memory)))
|
||||
(module (memory (data "x")) (func (export "memsize") (result i32) (memory.size)))
|
||||
(assert_return (invoke "memsize") (i32.const 1))
|
||||
|
||||
(assert_invalid (module (data (i32.const 0))) "unknown memory")
|
||||
@@ -36,11 +36,11 @@
|
||||
"unknown memory"
|
||||
)
|
||||
(assert_invalid
|
||||
(module (func (drop (current_memory))))
|
||||
(module (func (drop (memory.size))))
|
||||
"unknown memory"
|
||||
)
|
||||
(assert_invalid
|
||||
(module (func (drop (grow_memory (i32.const 0)))))
|
||||
(module (func (drop (memory.grow (i32.const 0)))))
|
||||
"unknown memory"
|
||||
)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
(memory 1)
|
||||
|
||||
(func $addr_limit (result i32)
|
||||
(i32.mul (current_memory) (i32.const 0x10000))
|
||||
(i32.mul (memory.size) (i32.const 0x10000))
|
||||
)
|
||||
|
||||
(func (export "store") (param $i i32) (param $v i32)
|
||||
@@ -13,8 +13,8 @@
|
||||
(i32.load (i32.add (call $addr_limit) (get_local $i)))
|
||||
)
|
||||
|
||||
(func (export "grow_memory") (param i32) (result i32)
|
||||
(grow_memory (get_local 0))
|
||||
(func (export "memory.grow") (param i32) (result i32)
|
||||
(memory.grow (get_local 0))
|
||||
)
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
(assert_trap (invoke "load" (i32.const 0)) "out of bounds memory access")
|
||||
(assert_trap (invoke "store" (i32.const 0x80000000) (i32.const 13)) "out of bounds memory access")
|
||||
(assert_trap (invoke "load" (i32.const 0x80000000)) "out of bounds memory access")
|
||||
(assert_return (invoke "grow_memory" (i32.const 0x10001)) (i32.const -1))
|
||||
(assert_return (invoke "memory.grow" (i32.const 0x10001)) (i32.const -1))
|
||||
|
||||
(module
|
||||
(memory 1)
|
||||
|
||||
@@ -172,11 +172,11 @@
|
||||
(nop) (get_local 0) (nop) (nop) (get_local 0) (nop) (nop) (i32.le_s)
|
||||
)
|
||||
|
||||
(func (export "as-grow_memory-last") (param i32) (result i32)
|
||||
(get_local 0) (nop) (grow_memory)
|
||||
(func (export "as-memory.grow-last") (param i32) (result i32)
|
||||
(get_local 0) (nop) (memory.grow)
|
||||
)
|
||||
(func (export "as-grow_memory-everywhere") (param i32) (result i32)
|
||||
(nop) (nop) (get_local 0) (nop) (nop) (grow_memory)
|
||||
(func (export "as-memory.grow-everywhere") (param i32) (result i32)
|
||||
(nop) (nop) (get_local 0) (nop) (nop) (memory.grow)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -243,8 +243,8 @@
|
||||
(assert_return (invoke "as-compare-last" (i32.const 3)) (i32.const 0))
|
||||
(assert_return (invoke "as-compare-everywhere" (i32.const 3)) (i32.const 1))
|
||||
|
||||
(assert_return (invoke "as-grow_memory-last" (i32.const 2)) (i32.const 1))
|
||||
(assert_return (invoke "as-grow_memory-everywhere" (i32.const 12)) (i32.const 3))
|
||||
(assert_return (invoke "as-memory.grow-last" (i32.const 2)) (i32.const 1))
|
||||
(assert_return (invoke "as-memory.grow-everywhere" (i32.const 12)) (i32.const 3))
|
||||
|
||||
(assert_invalid
|
||||
(module (func $type-i32 (result i32) (nop)))
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
(func (export "load_at_page_size") (result i32) (i32.load (i32.const 0x10000)))
|
||||
(func (export "store_at_page_size") (i32.store (i32.const 0x10000) (i32.const 3)))
|
||||
|
||||
(func (export "grow") (param $sz i32) (result i32) (grow_memory (get_local $sz)))
|
||||
(func (export "size") (result i32) (current_memory))
|
||||
(func (export "grow") (param $sz i32) (result i32) (memory.grow (get_local $sz)))
|
||||
(func (export "size") (result i32) (memory.size))
|
||||
)
|
||||
|
||||
(assert_return (invoke "size") (i32.const 0))
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
(module
|
||||
(memory 0)
|
||||
(func (export "grow") (param i32) (result i32) (grow_memory (get_local 0)))
|
||||
(func (export "grow") (param i32) (result i32) (memory.grow (get_local 0)))
|
||||
)
|
||||
|
||||
(assert_return (invoke "grow" (i32.const 0)) (i32.const 0))
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
(module
|
||||
(memory 0 10)
|
||||
(func (export "grow") (param i32) (result i32) (grow_memory (get_local 0)))
|
||||
(func (export "grow") (param i32) (result i32) (memory.grow (get_local 0)))
|
||||
)
|
||||
|
||||
(assert_return (invoke "grow" (i32.const 0)) (i32.const 0))
|
||||
|
||||
@@ -196,8 +196,8 @@
|
||||
(i32.wrap/i64 (return (i32.const 41)))
|
||||
)
|
||||
|
||||
(func (export "as-grow_memory-size") (result i32)
|
||||
(grow_memory (return (i32.const 40)))
|
||||
(func (export "as-memory.grow-size") (result i32)
|
||||
(memory.grow (return (i32.const 40)))
|
||||
)
|
||||
)
|
||||
|
||||
@@ -278,7 +278,7 @@
|
||||
|
||||
(assert_return (invoke "as-convert-operand") (i32.const 41))
|
||||
|
||||
(assert_return (invoke "as-grow_memory-size") (i32.const 40))
|
||||
(assert_return (invoke "as-memory.grow-size") (i32.const 40))
|
||||
|
||||
(assert_invalid
|
||||
(module (func $type-value-empty-vs-num (result f64) (return)))
|
||||
|
||||
@@ -421,5 +421,5 @@
|
||||
(assert_invalid (module (func (f64.promote/f32 (i32.const 0)))) "type mismatch")
|
||||
(assert_invalid (module (func (f64.reinterpret/i64 (i32.const 0)))) "type mismatch")
|
||||
|
||||
;; grow_memory
|
||||
(assert_invalid (module (memory 1) (func (grow_memory (f32.const 0)))) "type mismatch")
|
||||
;; memory.grow
|
||||
(assert_invalid (module (memory 1) (func (memory.grow (f32.const 0)))) "type mismatch")
|
||||
|
||||
@@ -203,8 +203,8 @@
|
||||
(i32.wrap/i64 (unreachable))
|
||||
)
|
||||
|
||||
(func (export "as-grow_memory-size") (result i32)
|
||||
(grow_memory (unreachable))
|
||||
(func (export "as-memory.grow-size") (result i32)
|
||||
(memory.grow (unreachable))
|
||||
)
|
||||
)
|
||||
|
||||
@@ -286,5 +286,5 @@
|
||||
|
||||
(assert_trap (invoke "as-convert-operand") "unreachable")
|
||||
|
||||
(assert_trap (invoke "as-grow_memory-size") "unreachable")
|
||||
(assert_trap (invoke "as-memory.grow-size") "unreachable")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user