cleanup [skip-ci]
This commit is contained in:
parent
6932741ac5
commit
1a35710da4
@ -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]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user