diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-11-29 18:33:41 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-29 18:33:41 -0800 |
commit | 24d274983df9f7dbeebe8a890297d4f30d5bbca7 (patch) | |
tree | b76f10f6de34e94b8c0e449b18427daeb34bee0c /test/spec/memory_size.wast | |
parent | 8c97dc61a713768d7f8302ec3a695c1207ce7239 (diff) | |
download | binaryen-24d274983df9f7dbeebe8a890297d4f30d5bbca7.tar.gz binaryen-24d274983df9f7dbeebe8a890297d4f30d5bbca7.tar.bz2 binaryen-24d274983df9f7dbeebe8a890297d4f30d5bbca7.zip |
Update spec test suite (#2484)
This updates spec test suite to that of the current up-to-date version
of https://github.com/WebAssembly/spec repo.
- All failing tests are added in `BLACKLIST` in shared.py with reasons.
- For tests that already existed and was passing and started failing
after the update, we add the new test to the blacklist and preserve
the old file by renaming it to 'old_[FILENAME].wast' not to lose test
coverage. When the cause of the error is fixed or the unsupported
construct gets support so the new test passes, we can delete the
corresponding 'old_[FILENAME].wast' file.
- Adds support for `spectest.print_[type] style imports.
Diffstat (limited to 'test/spec/memory_size.wast')
-rw-r--r-- | test/spec/memory_size.wast | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/test/spec/memory_size.wast b/test/spec/memory_size.wast new file mode 100644 index 000000000..239e66d8f --- /dev/null +++ b/test/spec/memory_size.wast @@ -0,0 +1,85 @@ +(module + (memory 0) + (func (export "size") (result i32) (memory.size)) + (func (export "grow") (param $sz i32) (drop (memory.grow (local.get $sz)))) +) + +(assert_return (invoke "size") (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1))) +(assert_return (invoke "size") (i32.const 1)) +(assert_return (invoke "grow" (i32.const 4))) +(assert_return (invoke "size") (i32.const 5)) +(assert_return (invoke "grow" (i32.const 0))) +(assert_return (invoke "size") (i32.const 5)) + +(module + (memory 1) + (func (export "size") (result i32) (memory.size)) + (func (export "grow") (param $sz i32) (drop (memory.grow (local.get $sz)))) +) + +(assert_return (invoke "size") (i32.const 1)) +(assert_return (invoke "grow" (i32.const 1))) +(assert_return (invoke "size") (i32.const 2)) +(assert_return (invoke "grow" (i32.const 4))) +(assert_return (invoke "size") (i32.const 6)) +(assert_return (invoke "grow" (i32.const 0))) +(assert_return (invoke "size") (i32.const 6)) + +(module + (memory 0 2) + (func (export "size") (result i32) (memory.size)) + (func (export "grow") (param $sz i32) (drop (memory.grow (local.get $sz)))) +) + +(assert_return (invoke "size") (i32.const 0)) +(assert_return (invoke "grow" (i32.const 3))) +(assert_return (invoke "size") (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1))) +(assert_return (invoke "size") (i32.const 1)) +(assert_return (invoke "grow" (i32.const 0))) +(assert_return (invoke "size") (i32.const 1)) +(assert_return (invoke "grow" (i32.const 4))) +(assert_return (invoke "size") (i32.const 1)) +(assert_return (invoke "grow" (i32.const 1))) +(assert_return (invoke "size") (i32.const 2)) + +(module + (memory 3 8) + (func (export "size") (result i32) (memory.size)) + (func (export "grow") (param $sz i32) (drop (memory.grow (local.get $sz)))) +) + +(assert_return (invoke "size") (i32.const 3)) +(assert_return (invoke "grow" (i32.const 1))) +(assert_return (invoke "size") (i32.const 4)) +(assert_return (invoke "grow" (i32.const 3))) +(assert_return (invoke "size") (i32.const 7)) +(assert_return (invoke "grow" (i32.const 0))) +(assert_return (invoke "size") (i32.const 7)) +(assert_return (invoke "grow" (i32.const 2))) +(assert_return (invoke "size") (i32.const 7)) +(assert_return (invoke "grow" (i32.const 1))) +(assert_return (invoke "size") (i32.const 8)) + + +;; Type errors + +(assert_invalid + (module + (memory 1) + (func $type-result-i32-vs-empty + (memory.size) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-result-i32-vs-f32 (result f32) + (memory.size) + ) + ) + "type mismatch" +) |