HSU2JRJRNTEP3LCTMNECDEUGYMGB7JVTL55GISKYNY6KTWDDC42AC
MBWCMSM3OIMMKJXKIVZXFCV5SH7QM3T4ERDJBTBBYONYRSOEZFHAC
JITJ6VHLW7JJAQUFG4LBZOMEXORKSBKJYQZ4DALCVLYAWM4BDISQC
3RX7PY4U2WNHO6H77BQHLGGZTA7NDPGEHRRBRAB5SNLNAUDBIA6QC
64WSQVMQZ4U4VHDNNO2HIYUB5WQT7U6E2463CSVBCZ7EDGTYUEDAC
7LYBCG3UV5RJ46YMJMHRO6QCQDZVCO6WTB3DFGMKLKPZKYXPYMYAC
XUTVWAWRMPTZ7BORZVFUMSGKV2EOGN6GEWPHPSTZH5HFC7ME3G4QC
HEECW22CT23RSAOLQ3DFYZ63TU7URGAZ3RKWTJFFTJNLPXIVFGFAC
O2DTNJ3ZOJJKDHGPNE2DZSZF7CFU4G5D65RIDOYZHYYBH3JZAAIAC
int eq(int a, int b) {
return a == b;
}
int ne(int a, int b) {
return a != b;
}
int lt(int a, int b) {
return a < b;
}
int gt(int a, int b) {
return a > b;
}
int le(int a, int b) {
return a <= b;
}
int ge(int a, int b) {
return a >= b;
}
{:section_body, [{[:i32, :i32], [:i32]}]},
{:section_type, :function},
{:section_body, [0, 0, 0, 0, 0, 0]},
{:section_type, :memory},
{:section_body, [{2, nil}]},
{:section_type, :global},
{:section_body,
[{{:i32, :const}, ["i32.const": 66560]}, {{:i32, :const}, ["i32.const": 1024]}]},
{:section_type, :export},
{[:i32], [:i32]},
{[], [:i32]},
{[:i32, :i32], [:i32]}
{"memory", {:mem, 0}},
{"__heap_base", {:global, 0}},
{"__data_end", {:global, 1}},
{"eq", {:func, 0}},
{"ne", {:func, 1}},
{"lt", {:func, 2}},
{"gt", {:func, 3}},
{"le", {:func, 4}},
{"ge", {:func, 5}}
{:section_type, :code},
{:section_body,
[
%{
code: %{
expr: [{:"local.get", 0}, {:"local.get", 1}, :"i32.eq"],
locals: []
},
size: 7
},
%{
code: %{expr: [{:"local.get", 0}, {:"local.get", 1}, :"i32.ne"], locals: []},
size: 7
},
%{
code: %{expr: [{:"local.get", 0}, {:"local.get", 1}, :"i32.lt_s"], locals: []},
size: 7
},
%{
code: %{expr: [{:"local.get", 0}, {:"local.get", 1}, :"i32.gt_s"], locals: []},
size: 7
},
%{
code: %{expr: [{:"local.get", 0}, {:"local.get", 1}, :"i32.le_s"], locals: []},
size: 7
},
%{
code: %{expr: [{:"local.get", 0}, {:"local.get", 1}, :"i32.ge_s"], locals: []},
size: 7
}
]}
]
end
test "9_all" do
assert parse_file("test_data/9_all.opt.wasm")
|> Enum.filter(fn {k, _} -> k == :section_type or k == :section_body end) ==
[
{:section_type, :type},
{:section_body, [{[:i32, :i32], [:i32]}, {[:i32], [:i32]}, {[], [:i32]}]},
},
%{
code: %{
expr: [{:"local.get", 0}, {:"local.get", 1}, :"i32.eq"],
locals: []
},
size: 7
},
%{
code: %{expr: [{:"local.get", 0}, {:"local.get", 1}, :"i32.ne"], locals: []},
size: 7
},
%{
code: %{expr: [{:"local.get", 0}, {:"local.get", 1}, :"i32.lt_s"], locals: []},
size: 7
},
%{
code: %{expr: [{:"local.get", 0}, {:"local.get", 1}, :"i32.gt_s"], locals: []},
size: 7
},
%{
code: %{expr: [{:"local.get", 0}, {:"local.get", 1}, :"i32.le_s"], locals: []},
size: 7
},
%{
code: %{expr: [{:"local.get", 0}, {:"local.get", 1}, :"i32.ge_s"], locals: []},
size: 7