Lines Matching refs:js
147 const char *js = "{\"x\": \"va\\\\ue\", \"y\": \"value y\"}"; in test_partial_string() local
150 for (i = 1; i <= strlen(js); i++) { in test_partial_string()
151 r = jsmn_parse(&p, js, i, tok, sizeof(tok)/sizeof(tok[0])); in test_partial_string()
152 if (i == strlen(js)) { in test_partial_string()
154 check(tokeq(js, tok, 5, in test_partial_string()
173 const char *js = "[ 1, true, [123, \"hello\"]]"; in test_partial_array() local
176 for (i = 1; i <= strlen(js); i++) { in test_partial_array()
177 r = jsmn_parse(&p, js, i, tok, sizeof(tok)/sizeof(tok[0])); in test_partial_array()
178 if (i == strlen(js)) { in test_partial_array()
180 check(tokeq(js, tok, 6, in test_partial_array()
200 const char *js; in test_array_nomem() local
202 js = " [ 1, true, [123, \"hello\"]]"; in test_array_nomem()
208 r = jsmn_parse(&p, js, strlen(js), toksmall, i); in test_array_nomem()
213 r = jsmn_parse(&p, js, strlen(js), toklarge, 10); in test_array_nomem()
215 check(tokeq(js, toklarge, 4, in test_array_nomem()
231 const char *js; in test_unquoted_keys() local
234 js = "key1: \"value\"\nkey2 : 123"; in test_unquoted_keys()
236 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_unquoted_keys()
238 check(tokeq(js, tok, 4, in test_unquoted_keys()
251 const char *js; in test_issue_22() local
253 js = "{ \"height\":10, \"layers\":[ { \"data\":[6,6], \"height\":10, " in test_issue_22()
262 r = jsmn_parse(&p, js, strlen(js), tokens, 128); in test_issue_22()
268 const char *js = in test_issue_27() local
270 check(parse(js, JSMN_ERROR_PART, 8)); in test_issue_27()
275 const char *js; in test_input_length() local
280 js = "{\"a\": 0}garbage"; in test_input_length()
283 r = jsmn_parse(&p, js, 8, tokens, 10); in test_input_length()
285 check(tokeq(js, tokens, 3, in test_input_length()
294 const char *js; in test_count() local
296 js = "{}"; in test_count()
298 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 1); in test_count()
300 js = "[]"; in test_count()
302 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 1); in test_count()
304 js = "[[]]"; in test_count()
306 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 2); in test_count()
308 js = "[[], []]"; in test_count()
310 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 3); in test_count()
312 js = "[[], []]"; in test_count()
314 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 3); in test_count()
316 js = "[[], [[]], [[], []]]"; in test_count()
318 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 7); in test_count()
320 js = "[\"a\", [[], []]]"; in test_count()
322 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 5); in test_count()
324 js = "[[], \"[], [[]]\", [[]]]"; in test_count()
326 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 5); in test_count()
328 js = "[1, 2, 3]"; in test_count()
330 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 4); in test_count()
332 js = "[1, 2, [3, \"a\"], null]"; in test_count()
334 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 7); in test_count()
342 const char *js; in test_nonstrict() local
343 js = "a: 0garbage"; in test_nonstrict()
344 check(parse(js, 2, 2, in test_nonstrict()
348 js = "Day : 26\nMonth : Sep\n\nYear: 12"; in test_nonstrict()
349 check(parse(js, 6, 6, in test_nonstrict()
358 js = "\"key {1\": 1234"; in test_nonstrict()
359 check(parse(js, 2, 2, in test_nonstrict()
369 const char *js; in test_unmatched_brackets() local
370 js = "\"key 1\": 1234}"; in test_unmatched_brackets()
371 check(parse(js, JSMN_ERROR_INVAL, 2)); in test_unmatched_brackets()
372 js = "{\"key 1\": 1234"; in test_unmatched_brackets()
373 check(parse(js, JSMN_ERROR_PART, 3)); in test_unmatched_brackets()
374 js = "{\"key 1\": 1234}}"; in test_unmatched_brackets()
375 check(parse(js, JSMN_ERROR_INVAL, 3)); in test_unmatched_brackets()
376 js = "\"key 1\"}: 1234"; in test_unmatched_brackets()
377 check(parse(js, JSMN_ERROR_INVAL, 3)); in test_unmatched_brackets()
378 js = "{\"key {1\": 1234}"; in test_unmatched_brackets()
379 check(parse(js, 3, 3, in test_unmatched_brackets()
383 js = "{{\"key 1\": 1234}"; in test_unmatched_brackets()
384 check(parse(js, JSMN_ERROR_PART, 4)); in test_unmatched_brackets()