MVP #1

Merged
jbwdevries merged 73 commits from idea_crc32 into master 2022-08-21 12:59:21 +00:00
Showing only changes of commit 1a35710da4 - Show all commits

View File

@ -7,6 +7,15 @@ from pywasm import Runtime
from .helpers import wat2wasm
def run(code_wat):
code_wasm = wat2wasm(code_wat)
module = binary.Module.from_reader(io.BytesIO(code_wasm))
runtime = Runtime(module, {}, {})
out_put = runtime.exec('testEntry', [])
return (runtime, out_put)
@pytest.mark.parametrize('size,offset,exp_out_put', [
('32', 0, 0x3020100),
('32', 1, 0x4030201),
@ -24,12 +33,8 @@ def test_i32_64_load(size, offset, exp_out_put):
i{size}.load
return ))
"""
code_wasm = wat2wasm(code_wat)
module = binary.Module.from_reader(io.BytesIO(code_wasm))
runtime = Runtime(module, {}, {})
out_put = runtime.exec('testEntry', [])
(_, out_put) = run(code_wat)
assert exp_out_put == out_put
def test_load_then_store():
@ -58,12 +63,8 @@ def test_load_then_store():
i32.const 9
return ))
"""
code_wasm = wat2wasm(code_wat)
module = binary.Module.from_reader(io.BytesIO(code_wasm))
(runtime, out_put) = run(code_wat)
runtime = Runtime(module, {}, {})
out_put = runtime.exec('testEntry', [])
assert 9 == out_put
assert (b'\x0c'+ b'\00' * 23) == runtime.store.mems[0].data[:24]