--- a/tests/test_json.c Fri Nov 01 17:24:51 2024 +0100 +++ b/tests/test_json.c Fri Nov 01 17:35:42 2024 +0100 @@ -72,7 +72,7 @@ CxJsonValue *message = cxJsonObjGet(obj, "message"); CX_TEST_ASSERT(cxJsonIsString(message)); CX_TEST_ASSERT(0 == cx_strcmp( - cx_strcast(cxJsonAsString(message)), + cxJsonAsCxString(message), cx_str("success")) ); @@ -80,14 +80,20 @@ CX_TEST_ASSERT(cxJsonIsObject(position)); CxJsonValue *longitude = cxJsonObjGet(position, "longitude"); CX_TEST_ASSERT(cxJsonIsNumber(longitude)); + CX_TEST_ASSERT(!cxJsonIsInteger(longitude)); CX_TEST_ASSERT(cxJsonAsDouble(longitude) == -94.7099); + CX_TEST_ASSERT(cxJsonAsInteger(longitude) == -94); CxJsonValue *latitude = cxJsonObjGet(position, "latitude"); CX_TEST_ASSERT(cxJsonIsNumber(latitude)); + CX_TEST_ASSERT(!cxJsonIsInteger(latitude)); CX_TEST_ASSERT(cxJsonAsDouble(latitude) == 51.5539); + CX_TEST_ASSERT(cxJsonAsInteger(latitude) == 51); CxJsonValue *timestamp = cxJsonObjGet(obj, "timestamp"); CX_TEST_ASSERT(cxJsonIsInteger(timestamp)); + CX_TEST_ASSERT(cxJsonIsNumber(timestamp)); CX_TEST_ASSERT(cxJsonAsInteger(timestamp) == 1729348561); + CX_TEST_ASSERT(cxJsonAsDouble(timestamp) == 1729348561.0); CxJsonValue *alive = cxJsonObjGet(obj, "alive"); CX_TEST_ASSERT(cxJsonIsBool(alive)); @@ -140,7 +146,7 @@ CxJsonValue *message = cxJsonObjGet(obj, "message"); CX_TEST_ASSERT(cxJsonIsString(message)); CX_TEST_ASSERT(0 == cx_strcmp( - cx_strcast(cxJsonAsString(message)), + cxJsonAsCxString(message), cx_str("success")) ); CxJsonValue *timestamp = cxJsonObjGet(obj, "__timestamp");