test/json.c

changeset 30
d33eaaec15da
parent 29
b8c826c720f3
--- a/test/json.c	Thu Dec 11 22:58:02 2025 +0100
+++ b/test/json.c	Fri Dec 12 10:42:53 2025 +0100
@@ -164,17 +164,17 @@
         CX_TEST_ASSERT(u64 && u64->type == CX_JSON_INTEGER);
         CX_TEST_ASSERT(d && d->type == CX_JSON_NUMBER);
         
-        CX_TEST_ASSERT(!cx_strcmp(str->value.string, test.str));
-        CX_TEST_ASSERT(!cx_strcmp(str2->value.string, test.str2));
-        CX_TEST_ASSERT(i8->value.integer == test.i8);
-        CX_TEST_ASSERT(u8->value.integer == test.u8);
-        CX_TEST_ASSERT(i16->value.integer == test.i16);
-        CX_TEST_ASSERT(u16->value.integer == test.u16);
-        CX_TEST_ASSERT(i32->value.integer == test.i32);
-        CX_TEST_ASSERT(u32->value.integer == test.u32);
-        CX_TEST_ASSERT(i64->value.integer == test.i64);
-        CX_TEST_ASSERT(u64->value.integer == test.u64);
-        CX_TEST_ASSERT(d->value.number < test.d + 0.1 && d->value.number > test.d - 0.1);
+        CX_TEST_ASSERT(!cx_strcmp(str->string, test.str));
+        CX_TEST_ASSERT(!cx_strcmp(str2->string, test.str2));
+        CX_TEST_ASSERT(i8->integer == test.i8);
+        CX_TEST_ASSERT(u8->integer == test.u8);
+        CX_TEST_ASSERT(i16->integer == test.i16);
+        CX_TEST_ASSERT(u16->integer == test.u16);
+        CX_TEST_ASSERT(i32->integer == test.i32);
+        CX_TEST_ASSERT(u32->integer == test.u32);
+        CX_TEST_ASSERT(i64->integer == test.i64);
+        CX_TEST_ASSERT(u64->integer == test.u64);
+        CX_TEST_ASSERT(d->number < test.d + 0.1 && d->number > test.d - 0.1);
         
         cxJsonValueFree(value);
     }
@@ -207,7 +207,7 @@
         CxJsonValue *v = cxJsonObjGet(value, "id");
         CX_TEST_ASSERT(v);
         CX_TEST_ASSERT(cxJsonIsInteger(v));
-        CX_TEST_ASSERT(v->value.integer == t4.id);
+        CX_TEST_ASSERT(v->integer == t4.id);
         
         v = cxJsonObjGet(value, "test2");
         CX_TEST_ASSERT(v);
@@ -216,12 +216,12 @@
         CxJsonValue *s = cxJsonObjGet(v, "i");
         CX_TEST_ASSERT(s);
         CX_TEST_ASSERT(cxJsonIsInteger(s));
-        CX_TEST_ASSERT(s->value.integer == t2_2.i);
+        CX_TEST_ASSERT(s->integer == t2_2.i);
         
         s = cxJsonObjGet(v, "name");
         CX_TEST_ASSERT(s);
         CX_TEST_ASSERT(cxJsonIsString(s));
-        CX_TEST_ASSERT(!cx_strcmp(s->value.string, t2_2.name));
+        CX_TEST_ASSERT(!cx_strcmp(s->string, t2_2.name));
         
         v = cxJsonObjGet(value, "test3");
         CX_TEST_ASSERT(v);
@@ -230,7 +230,7 @@
         s = cxJsonObjGet(v, "test3");
         CX_TEST_ASSERT(s);
         CX_TEST_ASSERT(cxJsonIsString(s));
-        CX_TEST_ASSERT(!cx_strcmp(s->value.string, t3.test3));
+        CX_TEST_ASSERT(!cx_strcmp(s->string, t3.test3));
         
         s = cxJsonObjGet(v, "test2");
         CX_TEST_ASSERT(s);
@@ -239,12 +239,12 @@
         CxJsonValue *x = cxJsonObjGet(s, "i");
         CX_TEST_ASSERT(x);
         CX_TEST_ASSERT(cxJsonIsInteger(x));
-        CX_TEST_ASSERT(x->value.integer == t2_1.i);
+        CX_TEST_ASSERT(x->integer == t2_1.i);
         
         x = cxJsonObjGet(s, "name");
         CX_TEST_ASSERT(x);
         CX_TEST_ASSERT(cxJsonIsString(x));
-        CX_TEST_ASSERT(!cx_strcmp(x->value.string, t2_1.name));
+        CX_TEST_ASSERT(!cx_strcmp(x->string, t2_1.name));
         
         cxJsonValueFree(value);
     }
@@ -279,7 +279,7 @@
         CxJsonValue *v = cxJsonObjGet(value, "test");
         CX_TEST_ASSERT(v);
         CX_TEST_ASSERT(cxJsonIsString(v));
-        CX_TEST_ASSERT(!cx_strcmp(v->value.string, test5.test));
+        CX_TEST_ASSERT(!cx_strcmp(v->string, test5.test));
         
         v = cxJsonObjGet(value, "test2List");
         CX_TEST_ASSERT(v);
@@ -289,28 +289,28 @@
         CX_TEST_ASSERT(cxJsonIsObject(x));
         CxJsonValue *z = cxJsonObjGet(x, "i");
         CX_TEST_ASSERT(cxJsonIsInteger(z));
-        CX_TEST_ASSERT(z->value.integer == c1.i);
+        CX_TEST_ASSERT(z->integer == c1.i);
         z = cxJsonObjGet(x, "name");
         CX_TEST_ASSERT(cxJsonIsString(z));
-        CX_TEST_ASSERT(!cx_strcmp(z->value.string, c1.name));
+        CX_TEST_ASSERT(!cx_strcmp(z->string, c1.name));
         
         x = cxJsonArrGet(v, 1);
         CX_TEST_ASSERT(cxJsonIsObject(x));
         z = cxJsonObjGet(x, "i");
         CX_TEST_ASSERT(cxJsonIsInteger(z));
-        CX_TEST_ASSERT(z->value.integer == c2.i);
+        CX_TEST_ASSERT(z->integer == c2.i);
         z = cxJsonObjGet(x, "name");
         CX_TEST_ASSERT(cxJsonIsString(z));
-        CX_TEST_ASSERT(!cx_strcmp(z->value.string, c2.name));
+        CX_TEST_ASSERT(!cx_strcmp(z->string, c2.name));
         
         x = cxJsonArrGet(v, 2);
         CX_TEST_ASSERT(cxJsonIsObject(x));
         z = cxJsonObjGet(x, "i");
         CX_TEST_ASSERT(cxJsonIsInteger(z));
-        CX_TEST_ASSERT(z->value.integer == c3.i);
+        CX_TEST_ASSERT(z->integer == c3.i);
         z = cxJsonObjGet(x, "name");
         CX_TEST_ASSERT(cxJsonIsString(z));
-        CX_TEST_ASSERT(!cx_strcmp(z->value.string, c3.name));
+        CX_TEST_ASSERT(!cx_strcmp(z->string, c3.name));
         
         cxJsonValueFree(value);
     }

mercurial