tests/test_json.c

changeset 1177
04ede4de9cec
parent 1157
3565ae61a5a2
child 1179
ca4c6f590a08
equal deleted inserted replaced
1176:247db6e629ad 1177:04ede4de9cec
195 195
196 CxJsonValue *wide = cxJsonObjGet(obj, "wide"); 196 CxJsonValue *wide = cxJsonObjGet(obj, "wide");
197 CX_TEST_ASSERT(cxJsonIsString(wide)); 197 CX_TEST_ASSERT(cxJsonIsString(wide));
198 CX_TEST_ASSERT(0 == cx_strcmp( 198 CX_TEST_ASSERT(0 == cx_strcmp(
199 cxJsonAsCxString(wide), 199 cxJsonAsCxString(wide),
200 CX_STR("\u03a3\u29b0")) 200 CX_STR(u8"\u03a3\u29b0"))
201 ); 201 );
202 202
203 CxJsonValue *surrogatepair1 = cxJsonObjGet(obj, "surrogatepair1"); 203 CxJsonValue *surrogatepair1 = cxJsonObjGet(obj, "surrogatepair1");
204 CX_TEST_ASSERT(cxJsonIsString(surrogatepair1)); 204 CX_TEST_ASSERT(cxJsonIsString(surrogatepair1));
205 CX_TEST_ASSERT(0 == cx_strcmp( 205 CX_TEST_ASSERT(0 == cx_strcmp(
213 cxJsonAsCxString(surrogatepair2), 213 cxJsonAsCxString(surrogatepair2),
214 CX_STR("test\xf0\x9f\xaf\xb1" "AA")) 214 CX_STR("test\xf0\x9f\xaf\xb1" "AA"))
215 ); 215 );
216 216
217 CxJsonValue *mixed2 = cxJsonObjGet(obj, "mixed2"); 217 CxJsonValue *mixed2 = cxJsonObjGet(obj, "mixed2");
218 CX_TEST_ASSERT(cxJsonIsString(mixed2)); 218 char test[16];
219 strncpy(test, mixed2->value.string.ptr, 15);
220 CX_TEST_ASSERT(cxJsonIsString(mixed2));
219 CX_TEST_ASSERT(0 == cx_strcmp( 221 CX_TEST_ASSERT(0 == cx_strcmp(
220 cxJsonAsCxString(mixed2), 222 cxJsonAsCxString(mixed2),
221 CX_STR("123\u03a3\xf0\x9f\xaf\x85ß")) 223 CX_STR("123\xce\xa3\xf0\x9f\xaf\x85ß"))
222 ); 224 );
223 225
224 cxJsonValueFree(obj); 226 cxJsonValueFree(obj);
225 } 227 }
226 cxJsonDestroy(&json); 228 cxJsonDestroy(&json);

mercurial