MCPcopy Create free account
hub / github.com/WebAssembly/wasm-c-api / check_call

Function check_call

example/table.c:51–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51void check_call(wasm_func_t* func, int32_t arg1, int32_t arg2, int32_t expected) {
52 wasm_val_t vs[2] = { WASM_I32_VAL(arg1), WASM_I32_VAL(arg2) };
53 wasm_val_t r[1] = { WASM_INIT_VAL };
54 wasm_val_vec_t args = WASM_ARRAY_VEC(vs);
55 wasm_val_vec_t results = WASM_ARRAY_VEC(r);
56 if (wasm_func_call(func, &args, &results) || r[0].of.i32 != expected) {
57 printf("> Error on result\n");
58 exit(1);
59 }
60}
61
62void check_trap(wasm_func_t* func, int32_t arg1, int32_t arg2) {
63 wasm_val_t vs[2] = { WASM_I32_VAL(arg1), WASM_I32_VAL(arg2) };

Callers 2

mainFunction · 0.70
mainFunction · 0.70

Calls 1

wasm_func_callFunction · 0.85

Tested by

no test coverage detected