diff dowa/dowa_test.c @ 260:1f9877b637e9

Add Copilot-powered cyberpunk JRPG chat Integrate the production JRPG chat with Seobeo streaming, Deita persistence, and a Bazel-managed Copilot SDK and LiteLLM inference stack. Co-authored-by: Copilot <[email protected]>
author MrJuneJune <mrjunejune@users.noreply.github.com>
date Wed, 05 Aug 2026 09:19:41 -0700
parents 655ea0b661fd
children 04fee26ecce0
line wrap: on
line diff
--- a/dowa/dowa_test.c	Wed Aug 05 09:19:41 2026 -0700
+++ b/dowa/dowa_test.c	Wed Aug 05 09:19:41 2026 -0700
@@ -315,6 +315,27 @@
     printf("UUID %s\n", uuid);
   }
 
+  {
+    Dowa_Arena *json_arena = Dowa_Arena_Create(1024);
+    char raw[] = {'"', '\\', '\n', '\t', 0x01, 'x', '\0'};
+    char *escaped = Dowa_JSON_Escape_String(raw, 6, json_arena);
+    assert(escaped);
+    assert(strcmp(escaped, "\\\"\\\\\\n\\t\\u0001x") == 0);
+    Dowa_Arena_Free(json_arena);
+  }
+
+  {
+    Dowa_Arena *json_arena = Dowa_Arena_Create(1024);
+    const char *source = "{\"message\":\"say \\\"hello\\\"\\\\now\"}";
+    Dowa_JSON_Value parsed = Dowa_JSON_Parse(
+        source, (int32)strlen(source), json_arena);
+    assert(parsed.type == DOWA_JSON_OBJECT);
+    char *message = Dowa_JSON_Get_String(parsed.object_val, "message");
+    assert(message);
+    assert(strcmp(message, "say \"hello\"\\now") == 0);
+    Dowa_Arena_Free(json_arena);
+  }
+
   printf("=== Math/Random === \n\n");
 
   printf("\n  RandomNumberGenerator\n\n");