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

Function check_trap

example/memory.c:73–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void check_trap(wasm_func_t* func, int i, wasm_val_t args[]) {
74 wasm_val_t r = WASM_INIT_VAL;
75 wasm_val_vec_t args_ = {i, args};
76 wasm_val_vec_t results = {1, &r};
77 own wasm_trap_t* trap = wasm_func_call(func, &args_, &results);
78 if (! trap) {
79 printf("> Error on result, expected trap\n");
80 exit(1);
81 }
82 wasm_trap_delete(trap);
83}
84
85void check_trap1(wasm_func_t* func, int32_t arg) {
86 wasm_val_t args[] = { WASM_I32_VAL(arg) };

Callers 2

check_trap1Function · 0.70
check_trap2Function · 0.70

Calls 1

wasm_func_callFunction · 0.85

Tested by

no test coverage detected