-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix table ref type * add table unit test
- Loading branch information
1 parent
b6cf5bf
commit 37b5b28
Showing
4 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
(module | ||
(table 1 funcref)) | ||
(table (import "spectest" "table") 0 funcref) | ||
(table 0 funcref) | ||
(table 1 funcref) | ||
(table 1 100 funcref) | ||
(table 0 externref) | ||
(table 1 externref) | ||
(table 1 100 externref) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import pytest | ||
from pyk.kast.inner import KApply, KInner | ||
from wasm.datatypes import ExternAddress, FunctionAddress, Limits, Table, TableType | ||
|
||
from pykwasm import wasm2kast | ||
from pykwasm.kwasm_ast import KInt, externref, funcref | ||
|
||
TABLE_TEST_DATA = ( | ||
(Table(TableType(Limits(0, None), FunctionAddress)), KApply('limitsMin', [KInt(0)]), funcref), | ||
(Table(TableType(Limits(0, 100), ExternAddress)), KApply('limitsMinMax', [KInt(0), KInt(100)]), externref), | ||
) | ||
|
||
|
||
@pytest.mark.parametrize(('input', 'limits', 'typ'), TABLE_TEST_DATA) | ||
def test_table(input: Table, limits: KInner, typ: KInner) -> None: | ||
# When | ||
t = wasm2kast.table(input) | ||
|
||
# Then | ||
assert limits == t.args[0] | ||
assert typ == t.args[1] |