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

Function check_trap

example/table.c:62–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) };
64 wasm_val_t r[1] = { WASM_INIT_VAL };
65 wasm_val_vec_t args = WASM_ARRAY_VEC(vs);
66 wasm_val_vec_t results = WASM_ARRAY_VEC(r);
67 own wasm_trap_t* trap = wasm_func_call(func, &args, &results);
68 if (! trap) {
69 printf("> Error on result, expected trap\n");
70 exit(1);
71 }
72 wasm_trap_delete(trap);
73}
74
75
76int main(int argc, const char* argv[]) {

Callers 1

mainFunction · 0.70

Calls 1

wasm_func_callFunction · 0.85

Tested by

no test coverage detected