• Home
  • Raw
  • Download

Lines Matching refs:js

33 #define TOKEN_STRING(js, t, s) \  argument
34 (strncmp(js+(t).start, s, (t).end - (t).start) == 0 \
45 const char *js; in test_empty() local
50 js = "{}"; in test_empty()
52 r = jsmn_parse(&p, js, strlen(js), t, 10); in test_empty()
57 js = "[]"; in test_empty()
59 r = jsmn_parse(&p, js, strlen(js), t, 10); in test_empty()
64 js = "{\"a\":[]}"; in test_empty()
66 r = jsmn_parse(&p, js, strlen(js), t, 10); in test_empty()
72 js = "[{},{}]"; in test_empty()
74 r = jsmn_parse(&p, js, strlen(js), t, 10); in test_empty()
83 const char *js; in test_simple() local
88 js = "{\"a\": 0}"; in test_simple()
91 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_simple()
97 check(TOKEN_STRING(js, tokens[0], js)); in test_simple()
98 check(TOKEN_STRING(js, tokens[1], "a")); in test_simple()
99 check(TOKEN_STRING(js, tokens[2], "0")); in test_simple()
102 js = "[\"a\":{},\"b\":{}]"; in test_simple()
103 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_simple()
107 js = "{\n \"Day\": 26,\n \"Month\": 9,\n \"Year\": 12\n }"; in test_simple()
108 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_simple()
118 const char *js; in test_primitive() local
120 js = "\"boolVar\" : true"; in test_primitive()
122 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_primitive()
125 check(TOKEN_STRING(js, tok[0], "boolVar")); in test_primitive()
126 check(TOKEN_STRING(js, tok[1], "true")); in test_primitive()
128 js = "\"boolVar\" : false"; in test_primitive()
130 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_primitive()
133 check(TOKEN_STRING(js, tok[0], "boolVar")); in test_primitive()
134 check(TOKEN_STRING(js, tok[1], "false")); in test_primitive()
136 js = "\"intVar\" : 12345"; in test_primitive()
138 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_primitive()
141 check(TOKEN_STRING(js, tok[0], "intVar")); in test_primitive()
142 check(TOKEN_STRING(js, tok[1], "12345")); in test_primitive()
144 js = "\"floatVar\" : 12.345"; in test_primitive()
146 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_primitive()
149 check(TOKEN_STRING(js, tok[0], "floatVar")); in test_primitive()
150 check(TOKEN_STRING(js, tok[1], "12.345")); in test_primitive()
152 js = "\"nullVar\" : null"; in test_primitive()
154 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_primitive()
157 check(TOKEN_STRING(js, tok[0], "nullVar")); in test_primitive()
158 check(TOKEN_STRING(js, tok[1], "null")); in test_primitive()
167 const char *js; in test_string() local
169 js = "\"strVar\" : \"hello world\""; in test_string()
171 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_string()
174 check(TOKEN_STRING(js, tok[0], "strVar")); in test_string()
175 check(TOKEN_STRING(js, tok[1], "hello world")); in test_string()
177 js = "\"strVar\" : \"escapes: \\/\\r\\n\\t\\b\\f\\\"\\\\\""; in test_string()
179 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_string()
182 check(TOKEN_STRING(js, tok[0], "strVar")); in test_string()
183 check(TOKEN_STRING(js, tok[1], "escapes: \\/\\r\\n\\t\\b\\f\\\"\\\\")); in test_string()
185 js = "\"strVar\" : \"\""; in test_string()
187 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_string()
190 check(TOKEN_STRING(js, tok[0], "strVar")); in test_string()
191 check(TOKEN_STRING(js, tok[1], "")); in test_string()
200 const char *js; in test_partial_string() local
203 js = "\"x\": \"va"; in test_partial_string()
204 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_string()
206 check(TOKEN_STRING(js, tok[0], "x")); in test_partial_string()
209 js = "\"x\": \"valu"; in test_partial_string()
210 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_string()
212 check(TOKEN_STRING(js, tok[0], "x")); in test_partial_string()
215 js = "\"x\": \"value\""; in test_partial_string()
216 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_string()
219 check(TOKEN_STRING(js, tok[0], "x")); in test_partial_string()
220 check(TOKEN_STRING(js, tok[1], "value")); in test_partial_string()
222 js = "\"x\": \"value\", \"y\": \"value y\""; in test_partial_string()
223 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_string()
227 check(TOKEN_STRING(js, tok[0], "x")); in test_partial_string()
228 check(TOKEN_STRING(js, tok[1], "value")); in test_partial_string()
229 check(TOKEN_STRING(js, tok[2], "y")); in test_partial_string()
230 check(TOKEN_STRING(js, tok[3], "value y")); in test_partial_string()
240 const char *js; in test_unquoted_keys() local
243 js = "key1: \"value\"\nkey2 : 123"; in test_unquoted_keys()
245 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_unquoted_keys()
249 check(TOKEN_STRING(js, tok[0], "key1")); in test_unquoted_keys()
250 check(TOKEN_STRING(js, tok[1], "value")); in test_unquoted_keys()
251 check(TOKEN_STRING(js, tok[2], "key2")); in test_unquoted_keys()
252 check(TOKEN_STRING(js, tok[3], "123")); in test_unquoted_keys()
261 const char *js; in test_partial_array() local
264 js = " [ 1, true, "; in test_partial_array()
265 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_array()
269 js = " [ 1, true, [123, \"hello"; in test_partial_array()
270 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_array()
275 js = " [ 1, true, [123, \"hello\"]"; in test_partial_array()
276 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_array()
284 js = " [ 1, true, [123, \"hello\"]]"; in test_partial_array()
285 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_array()
300 const char *js; in test_array_nomem() local
302 js = " [ 1, true, [123, \"hello\"]]"; in test_array_nomem()
308 r = jsmn_parse(&p, js, strlen(js), toksmall, i); in test_array_nomem()
313 r = jsmn_parse(&p, js, strlen(js), toklarge, 10); in test_array_nomem()
327 const char *js; in test_objects_arrays() local
329 js = "[10}"; in test_objects_arrays()
331 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_objects_arrays()
334 js = "[10]"; in test_objects_arrays()
336 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_objects_arrays()
339 js = "{\"a\": 1]"; in test_objects_arrays()
341 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_objects_arrays()
344 js = "{\"a\": 1}"; in test_objects_arrays()
346 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_objects_arrays()
357 const char *js; in test_issue_22() local
359 js = "{ \"height\":10, \"layers\":[ { \"data\":[6,6], \"height\":10, " in test_issue_22()
368 r = jsmn_parse(&p, js, strlen(js), tokens, 128); in test_issue_22()
373 printf("%.*s\n", tokens[i].end - tokens[i].start, js + tokens[i].start); in test_issue_22()
389 const char *js; in test_unicode_characters() local
392 js = "{\"a\":\"\\uAbcD\"}"; in test_unicode_characters()
394 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_unicode_characters()
397 js = "{\"a\":\"str\\u0000\"}"; in test_unicode_characters()
399 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_unicode_characters()
402 js = "{\"a\":\"\\uFFFFstr\"}"; in test_unicode_characters()
404 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_unicode_characters()
407 js = "{\"a\":\"str\\uFFGFstr\"}"; in test_unicode_characters()
409 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_unicode_characters()
412 js = "{\"a\":\"str\\u@FfF\"}"; in test_unicode_characters()
414 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_unicode_characters()
417 js = "{\"a\":[\"\\u028\"]}"; in test_unicode_characters()
419 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_unicode_characters()
422 js = "{\"a\":[\"\\u0280\"]}"; in test_unicode_characters()
424 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_unicode_characters()
431 const char *js; in test_input_length() local
436 js = "{\"a\": 0}garbage"; in test_input_length()
439 r = jsmn_parse(&p, js, 8, tokens, 10); in test_input_length()
441 check(TOKEN_STRING(js, tokens[0], "{\"a\": 0}")); in test_input_length()
442 check(TOKEN_STRING(js, tokens[1], "a")); in test_input_length()
443 check(TOKEN_STRING(js, tokens[2], "0")); in test_input_length()
449 const char *js; in test_jwk() local
454 js = "{\"keys\":" in test_jwk()
473 num_tokens = jsmn_parse(&p, js, strlen(js), NULL, 0); in test_jwk()
474 printf("num_tokens=%d, len=%lu\n", num_tokens, strlen(js)); in test_jwk()
485 r = jsmn_parse(&p, js, strlen(js), tokens, num_tokens); in test_jwk()
489 const char *pjs = js + tokens[i].start; in test_jwk()
504 const char *js; in test_count() local
507 js = "{}"; in test_count()
509 r = jsmn_parse(&p, js, strlen(js), NULL, 0); in test_count()
512 js = "[]"; in test_count()
514 r = jsmn_parse(&p, js, strlen(js), NULL, 0); in test_count()
517 js = "[[]]"; in test_count()
519 r = jsmn_parse(&p, js, strlen(js), NULL, 0); in test_count()
522 js = "[[], []]"; in test_count()
524 r = jsmn_parse(&p, js, strlen(js), NULL, 0); in test_count()
527 js = "[[], []]"; in test_count()
529 r = jsmn_parse(&p, js, strlen(js), NULL, 0); in test_count()
532 js = "[[], [[]], [[], []]]"; in test_count()
534 r = jsmn_parse(&p, js, strlen(js), NULL, 0); in test_count()
537 js = "[\"a\", [[], []]]"; in test_count()
539 r = jsmn_parse(&p, js, strlen(js), NULL, 0); in test_count()
542 js = "[[], \"[], [[]]\", [[]]]"; in test_count()
544 r = jsmn_parse(&p, js, strlen(js), NULL, 0); in test_count()
547 js = "[1, 2, 3]"; in test_count()
549 r = jsmn_parse(&p, js, strlen(js), NULL, 0); in test_count()
552 js = "[1, 2, [3, \"a\"], null]"; in test_count()
554 r = jsmn_parse(&p, js, strlen(js), NULL, 0); in test_count()
583 const char *js; in test_nonstrict() local
588 js = "a: 0garbage"; in test_nonstrict()
591 r = jsmn_parse(&p, js, 4, tokens, 10); in test_nonstrict()
593 check(TOKEN_STRING(js, tokens[0], "a")); in test_nonstrict()
594 check(TOKEN_STRING(js, tokens[1], "0")); in test_nonstrict()
596 js = "Day : 26\nMonth : Sep\n\nYear: 12"; in test_nonstrict()
598 r = jsmn_parse(&p, js, strlen(js), tokens, 10); in test_nonstrict()