diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 16 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 42 |
2 files changed, 35 insertions, 23 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 4a63e931d..db1903cfd 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -165,9 +165,15 @@ void test_core() { BinaryenBreak(module, "the-body", NULL, NULL), BinaryenSwitch(module, switchValueNames, 1, "the-value", makeInt32(module, 0), makeInt32(module, 1)), BinaryenSwitch(module, switchBodyNames, 1, "the-body", makeInt32(module, 2), NULL), - BinaryenCall(module, "kitchen-sinker", callOperands4, 4), - BinaryenCallImport(module, "an-imported", callOperands2, 2), - BinaryenCallIndirect(module, makeInt32(module, 2449), callOperands4, 4, iiIfF), + BinaryenUnary(module, BinaryenEqZ(), // check the output type of the call node + BinaryenCall(module, "kitchen-sinker", callOperands4, 4, BinaryenInt32()) + ), + BinaryenUnary(module, BinaryenEqZ(), // check the output type of the call node + BinaryenCallImport(module, "an-imported", callOperands2, 2, BinaryenFloat32()) + ), + BinaryenUnary(module, BinaryenEqZ(), // check the output type of the call node + BinaryenCallIndirect(module, makeInt32(module, 2449), callOperands4, 4, iiIfF) + ), BinaryenGetLocal(module, 0, BinaryenInt32()), BinaryenSetLocal(module, 0, makeInt32(module, 101)), BinaryenLoad(module, 4, 0, 0, 0, BinaryenInt32(), makeInt32(module, 1)), @@ -195,8 +201,8 @@ void test_core() { // Imports BinaryenType iparams[2] = { BinaryenInt32(), BinaryenFloat64() }; - BinaryenFunctionTypeRef viF = BinaryenAddFunctionType(module, "viF", BinaryenNone(), iparams, 2); - BinaryenAddImport(module, "an-imported", "module", "base", viF); + BinaryenFunctionTypeRef fiF = BinaryenAddFunctionType(module, "fiF", BinaryenFloat32(), iparams, 2); + BinaryenAddImport(module, "an-imported", "module", "base", fiF); // Exports diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index cb037d80c..7a1366888 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -10,9 +10,9 @@ BinaryenFloat64: 4 (export "mem" memory) (start $starter) (type $iiIfF (func (param i32 i64 f32 f64) (result i32))) - (type $viF (func (param i32 f64))) + (type $fiF (func (param i32 f64) (result f32))) (type $v (func)) - (import $an-imported "module" "base" (param i32 f64)) + (import $an-imported "module" "base" (param i32 f64) (result f32)) (export "kitchen_sinker" $kitchen-sinker) (table $kitchen-sinker) (func $kitchen-sinker (type $iiIfF) (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32) @@ -293,22 +293,28 @@ BinaryenFloat64: 4 (br_table $the-body $the-body (i32.const 2) ) - (call $kitchen-sinker - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) - ) - (call_import $an-imported - (i32.const 13) - (f64.const 3.7) - ) - (call_indirect $iiIfF - (i32.const 2449) - (i32.const 13) - (i64.const 37) - (f32.const 1.2999999523162842) - (f64.const 3.7) + (i32.eqz + (call $kitchen-sinker + (i32.const 13) + (i64.const 37) + (f32.const 1.2999999523162842) + (f64.const 3.7) + ) + ) + (f32.eqz + (call_import $an-imported + (i32.const 13) + (f64.const 3.7) + ) + ) + (i32.eqz + (call_indirect $iiIfF + (i32.const 2449) + (i32.const 13) + (i64.const 37) + (f32.const 1.2999999523162842) + (f64.const 3.7) + ) ) (get_local $0) (set_local $0 |