MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / c1

Function c1

test/browser/test_worker_api_3.c:15–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13bool sawCalls[] = { false, false, false, false };
14
15void c1(char *data, int size, void *arg) {
16 assert((long)arg == 97);
17 assert(size >= sizeof(int));
18
19 int *x = (int*)data;
20 printf("c1: %d\n", x[0]);
21
22 if (*x >= 0 && *x < 4) {
23 // Calls should have happened in order.
24 sawCalls[*x] = true; // Note the call with current param was made
25 for (int i = 0; i < *x - 1; ++i) {
26 if (!sawCalls[i]) {
27 // If we were called out of order, fail this and all following calls.
28 sawCalls[*x] = false;
29 break;
30 }
31 }
32 } else {
33 assert(*x == 4);
34 // This is the last call. All prior calls should have occurred.
35 int result = 1; // Final call occurred.
36 for (int i = 0; i < 4; ++i)
37 if (sawCalls[i]) result++;
38 REPORT_RESULT(result);
39 }
40}
41
42int main() {
43 w1 = emscripten_create_worker("worker.js");

Callers

nothing calls this directly

Calls 2

printfFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected