Skip to content

Commit

Permalink
data segment test
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuoguo committed Oct 9, 2024
1 parent ea20ef7 commit d68a0d0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
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?
}

0 comments on commit d68a0d0

Please sign in to comment.