Skip to content

data segment test #54

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions benchmarks/wasm/data.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(module
(type (;0;) (func (param i32) (result i32)))
(type (;1;) (func (result i32)))
(func (;0;) (type 0) (param i32) (result i32)
local.get 0
i32.load8_u)
(func (;1;) (type 1) (result i32)
;; Call the `load_byte` function with an address of 0
i32.const 0
call 0)
(memory (;0;) 1)
;; (start 1) ;; should return 72
;; Define a memory with an initial size of 1 page (64KB)
(export "memory" (memory 0))
(export "main" (func 1))
;; Initialize memory using the `data` directive at offset 0
(data (;0;) (i32.const 0) "Hello"))
2 changes: 2 additions & 0 deletions src/test/scala/genwasym/TestEval.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ class TestEval extends FunSuite {
test("btree") { testFile("./benchmarks/wasm/btree/2o1u-unlabeled.wat") }
test("fib") { testFile("./benchmarks/wasm/fib.wat", None, Some(144)) }

test("data") { testFile("./benchmarks/wasm/data.wat", None, Some(72)) }

// TODO: add wasm spec tests? How to utilize wast files?
}
Loading