Mercurial
comparison mrjunejune/test/inference_bridge_test.c @ 261:b401627fc49e
Add JRPG mock flows and interactive previews
Add scripted mock SSE commands, custom event forwarding, animated chat turns, full-height message navigation, and a cyberpunk resume dossier.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <mrjunejune@users.noreply.github.com> |
|---|---|
| date | Wed, 05 Aug 2026 20:38:32 -0700 |
| parents | 1f9877b637e9 |
| children | 056790c4fb0d |
comparison
equal
deleted
inserted
replaced
| 260:1f9877b637e9 | 261:b401627fc49e |
|---|---|
| 11 pthread_cond_t condition; | 11 pthread_cond_t condition; |
| 12 int accepted; | 12 int accepted; |
| 13 int deltas; | 13 int deltas; |
| 14 int completed; | 14 int completed; |
| 15 int usage; | 15 int usage; |
| 16 int custom; | |
| 16 int done; | 17 int done; |
| 17 int closed; | 18 int closed; |
| 18 char delta[128]; | 19 char delta[128]; |
| 20 char custom_json[256]; | |
| 19 int64 input_tokens; | 21 int64 input_tokens; |
| 20 int64 output_tokens; | 22 int64 output_tokens; |
| 21 } Test_State; | 23 } Test_State; |
| 22 | 24 |
| 23 static void Handle_Event( | 25 static void Handle_Event( |
| 38 else if (strcmp(p_event->type, "assistant.usage") == 0) | 40 else if (strcmp(p_event->type, "assistant.usage") == 0) |
| 39 { | 41 { |
| 40 p_state->usage++; | 42 p_state->usage++; |
| 41 p_state->input_tokens = p_event->input_tokens; | 43 p_state->input_tokens = p_event->input_tokens; |
| 42 p_state->output_tokens = p_event->output_tokens; | 44 p_state->output_tokens = p_event->output_tokens; |
| 45 } | |
| 46 else if (strcmp(p_event->type, "tool.started") == 0) | |
| 47 { | |
| 48 p_state->custom++; | |
| 49 snprintf( | |
| 50 p_state->custom_json, | |
| 51 sizeof(p_state->custom_json), | |
| 52 "%s", | |
| 53 p_event->raw_json); | |
| 43 } | 54 } |
| 44 else if (strcmp(p_event->type, "turn.done") == 0 && | 55 else if (strcmp(p_event->type, "turn.done") == 0 && |
| 45 strncmp(p_event->request_id, "request-", 8) == 0) | 56 strncmp(p_event->request_id, "request-", 8) == 0) |
| 46 { | 57 { |
| 47 p_state->done++; | 58 p_state->done++; |
| 81 | 92 |
| 82 assert(state.accepted == 1); | 93 assert(state.accepted == 1); |
| 83 assert(state.deltas == 1); | 94 assert(state.deltas == 1); |
| 84 assert(state.completed == 1); | 95 assert(state.completed == 1); |
| 85 assert(state.usage == 1); | 96 assert(state.usage == 1); |
| 97 assert(state.custom == 1); | |
| 86 assert(strcmp(state.delta, "hello \"traveler\"\\path") == 0); | 98 assert(strcmp(state.delta, "hello \"traveler\"\\path") == 0); |
| 99 assert(strstr(state.custom_json, "\"name\":\"mock-search\"")); | |
| 87 assert(state.input_tokens == 7); | 100 assert(state.input_tokens == 7); |
| 88 assert(state.output_tokens == 3); | 101 assert(state.output_tokens == 3); |
| 89 | 102 |
| 90 char large_prompt[32 * 1024 + 1]; | 103 char large_prompt[32 * 1024 + 1]; |
| 91 memset(large_prompt, 0x01, sizeof(large_prompt) - 1); | 104 memset(large_prompt, 0x01, sizeof(large_prompt) - 1); |