238 CX_TEST_ASSERT(cxJsonIsString(obj)); |
238 CX_TEST_ASSERT(cxJsonIsString(obj)); |
239 CX_TEST_ASSERT(0 == cx_strcmp( |
239 CX_TEST_ASSERT(0 == cx_strcmp( |
240 cxJsonAsCxString(obj), |
240 cxJsonAsCxString(obj), |
241 CX_STR("too few \\u123 digits") |
241 CX_STR("too few \\u123 digits") |
242 )); |
242 )); |
|
243 cxJsonValueFree(obj); |
243 cxJsonFill(&json, "\"too many \\u00E456 digits\""); |
244 cxJsonFill(&json, "\"too many \\u00E456 digits\""); |
244 result = cxJsonNext(&json, &obj); |
245 result = cxJsonNext(&json, &obj); |
245 CX_TEST_ASSERT(result == CX_JSON_NO_ERROR); |
246 CX_TEST_ASSERT(result == CX_JSON_NO_ERROR); |
246 CX_TEST_ASSERT(cxJsonIsString(obj)); |
247 CX_TEST_ASSERT(cxJsonIsString(obj)); |
247 CX_TEST_ASSERT(0 == cx_strcmp( |
248 CX_TEST_ASSERT(0 == cx_strcmp( |
248 cxJsonAsCxString(obj), |
249 cxJsonAsCxString(obj), |
249 CX_STR("too many ä56 digits") |
250 CX_STR("too many ä56 digits") |
250 )); |
251 )); |
|
252 cxJsonValueFree(obj); |
251 cxJsonFill(&json, "\"only high \\uD800 surrogate\""); |
253 cxJsonFill(&json, "\"only high \\uD800 surrogate\""); |
252 result = cxJsonNext(&json, &obj); |
254 result = cxJsonNext(&json, &obj); |
253 CX_TEST_ASSERT(result == CX_JSON_NO_ERROR); |
255 CX_TEST_ASSERT(result == CX_JSON_NO_ERROR); |
254 CX_TEST_ASSERT(cxJsonIsString(obj)); |
256 CX_TEST_ASSERT(cxJsonIsString(obj)); |
255 CX_TEST_ASSERT(0 == cx_strcmp( |
257 CX_TEST_ASSERT(0 == cx_strcmp( |
256 cxJsonAsCxString(obj), |
258 cxJsonAsCxString(obj), |
257 CX_STR("only high \\uD800 surrogate") |
259 CX_STR("only high \\uD800 surrogate") |
258 )); |
260 )); |
|
261 cxJsonValueFree(obj); |
259 cxJsonFill(&json, "\"only low \\uDC00 surrogate\""); |
262 cxJsonFill(&json, "\"only low \\uDC00 surrogate\""); |
260 result = cxJsonNext(&json, &obj); |
263 result = cxJsonNext(&json, &obj); |
261 CX_TEST_ASSERT(result == CX_JSON_NO_ERROR); |
264 CX_TEST_ASSERT(result == CX_JSON_NO_ERROR); |
262 CX_TEST_ASSERT(cxJsonIsString(obj)); |
265 CX_TEST_ASSERT(cxJsonIsString(obj)); |
263 CX_TEST_ASSERT(0 == cx_strcmp( |
266 CX_TEST_ASSERT(0 == cx_strcmp( |
264 cxJsonAsCxString(obj), |
267 cxJsonAsCxString(obj), |
265 CX_STR("only low \\uDC00 surrogate") |
268 CX_STR("only low \\uDC00 surrogate") |
266 )); |
269 )); |
|
270 cxJsonValueFree(obj); |
267 cxJsonFill(&json, "\"two high \\uD800\\uD800 surrogates\""); |
271 cxJsonFill(&json, "\"two high \\uD800\\uD800 surrogates\""); |
268 result = cxJsonNext(&json, &obj); |
272 result = cxJsonNext(&json, &obj); |
269 CX_TEST_ASSERT(result == CX_JSON_NO_ERROR); |
273 CX_TEST_ASSERT(result == CX_JSON_NO_ERROR); |
270 CX_TEST_ASSERT(cxJsonIsString(obj)); |
274 CX_TEST_ASSERT(cxJsonIsString(obj)); |
271 CX_TEST_ASSERT(0 == cx_strcmp( |
275 CX_TEST_ASSERT(0 == cx_strcmp( |
272 cxJsonAsCxString(obj), |
276 cxJsonAsCxString(obj), |
273 CX_STR("two high \\uD800\\uD800 surrogates") |
277 CX_STR("two high \\uD800\\uD800 surrogates") |
274 )); |
278 )); |
|
279 cxJsonValueFree(obj); |
275 cxJsonFill(&json, "\"high plus bullshit \\uD800\\u567 foo\""); |
280 cxJsonFill(&json, "\"high plus bullshit \\uD800\\u567 foo\""); |
276 result = cxJsonNext(&json, &obj); |
281 result = cxJsonNext(&json, &obj); |
277 CX_TEST_ASSERT(result == CX_JSON_NO_ERROR); |
282 CX_TEST_ASSERT(result == CX_JSON_NO_ERROR); |
278 CX_TEST_ASSERT(cxJsonIsString(obj)); |
283 CX_TEST_ASSERT(cxJsonIsString(obj)); |
279 CX_TEST_ASSERT(0 == cx_strcmp( |
284 CX_TEST_ASSERT(0 == cx_strcmp( |
280 cxJsonAsCxString(obj), |
285 cxJsonAsCxString(obj), |
281 CX_STR("high plus bullshit \\uD800\\u567 foo") |
286 CX_STR("high plus bullshit \\uD800\\u567 foo") |
282 )); |
287 )); |
|
288 cxJsonValueFree(obj); |
283 } |
289 } |
284 cxJsonDestroy(&json); |
290 cxJsonDestroy(&json); |
285 } |
291 } |
286 |
292 |
287 CX_TEST(test_json_escaped_end_of_string) { |
293 CX_TEST(test_json_escaped_end_of_string) { |