Lines Matching refs:check

15 #define check(cond) do { if (!(cond)) fail(); } while (0)  macro
53 check(r >= 0); in test_empty()
54 check(t[0].type == JSMN_OBJECT); in test_empty()
55 check(t[0].start == 0 && t[0].end == 2); in test_empty()
60 check(r >= 0); in test_empty()
61 check(t[0].type == JSMN_ARRAY); in test_empty()
62 check(t[0].start == 0 && t[0].end == 2); in test_empty()
67 check(r >= 0); in test_empty()
68 check(t[0].type == JSMN_OBJECT && t[0].start == 0 && t[0].end == 8); in test_empty()
69 check(t[1].type == JSMN_STRING && t[1].start == 2 && t[1].end == 3); in test_empty()
70 check(t[2].type == JSMN_ARRAY && t[2].start == 5 && t[2].end == 7); in test_empty()
75 check(r >= 0); in test_empty()
76 check(t[0].type == JSMN_ARRAY && t[0].start == 0 && t[0].end == 7); in test_empty()
77 check(t[1].type == JSMN_OBJECT && t[1].start == 1 && t[1].end == 3); in test_empty()
78 check(t[2].type == JSMN_OBJECT && t[2].start == 4 && t[2].end == 6); in test_empty()
92 check(r >= 0); in test_simple()
93 check(TOKEN_EQ(tokens[0], 0, 8, JSMN_OBJECT)); in test_simple()
94 check(TOKEN_EQ(tokens[1], 2, 3, JSMN_STRING)); in test_simple()
95 check(TOKEN_EQ(tokens[2], 6, 7, JSMN_PRIMITIVE)); 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()
104 check(r >= 0); in test_simple()
109 check(r >= 0); in test_simple()
123 check(r >= 0 && tok[0].type == JSMN_STRING 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()
131 check(r >= 0 && tok[0].type == JSMN_STRING 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()
139 check(r >= 0 && tok[0].type == JSMN_STRING 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()
147 check(r >= 0 && tok[0].type == JSMN_STRING 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()
155 check(r >= 0 && tok[0].type == JSMN_STRING 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()
172 check(r >= 0 && tok[0].type == JSMN_STRING 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()
180 check(r >= 0 && tok[0].type == JSMN_STRING 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()
188 check(r >= 0 && tok[0].type == JSMN_STRING in test_string()
190 check(TOKEN_STRING(js, tok[0], "strVar")); in test_string()
191 check(TOKEN_STRING(js, tok[1], "")); in test_string()
205 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_STRING); in test_partial_string()
206 check(TOKEN_STRING(js, tok[0], "x")); in test_partial_string()
207 check(p.toknext == 1); in test_partial_string()
212 check(r == JSMN_ERROR_PART); in test_partial_string()
217 check(r == JSMN_ERROR_PART); in test_partial_string()
221 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_STRING); in test_partial_string()
222 check(TOKEN_STRING(js, tok[0], "x")); in test_partial_string()
223 check(p.toknext == 1); in test_partial_string()
227 check(r >= 0 && tok[0].type == JSMN_STRING in test_partial_string()
229 check(TOKEN_STRING(js, tok[0], "x")); in test_partial_string()
230 check(TOKEN_STRING(js, tok[1], "value")); in test_partial_string()
234 check(r >= 0 && tok[0].type == JSMN_STRING in test_partial_string()
237 check(TOKEN_STRING(js, tok[0], "x")); in test_partial_string()
238 check(TOKEN_STRING(js, tok[1], "value")); in test_partial_string()
239 check(TOKEN_STRING(js, tok[2], "y")); in test_partial_string()
240 check(TOKEN_STRING(js, tok[3], "value y")); in test_partial_string()
256 check(r >= 0 && tok[0].type == JSMN_PRIMITIVE in test_unquoted_keys()
259 check(TOKEN_STRING(js, tok[0], "key1")); in test_unquoted_keys()
260 check(TOKEN_STRING(js, tok[1], "value")); in test_unquoted_keys()
261 check(TOKEN_STRING(js, tok[2], "key2")); in test_unquoted_keys()
262 check(TOKEN_STRING(js, tok[3], "123")); in test_unquoted_keys()
276 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_ARRAY in test_partial_array()
281 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_ARRAY in test_partial_array()
287 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_ARRAY in test_partial_array()
292 check(tok[3].size == 2); in test_partial_array()
296 check(r >= 0 && tok[0].type == JSMN_ARRAY in test_partial_array()
300 check(tok[3].size == 2); in test_partial_array()
301 check(tok[0].size == 3); in test_partial_array()
319 check(r == JSMN_ERROR_NOMEM); in test_array_nomem()
324 check(r >= 0); in test_array_nomem()
326 check(toklarge[0].type == JSMN_ARRAY && toklarge[0].size == 3); in test_array_nomem()
327 check(toklarge[3].type == JSMN_ARRAY && toklarge[3].size == 2); in test_array_nomem()
341 check(r == JSMN_ERROR_INVAL); in test_objects_arrays()
346 check(r >= 0); in test_objects_arrays()
351 check(r == JSMN_ERROR_INVAL); in test_objects_arrays()
356 check(r >= 0); in test_objects_arrays()
377 check(r >= 0); in test_issue_22()
403 check(r >= 0); in test_unicode_characters()
408 check(r >= 0); in test_unicode_characters()
413 check(r >= 0); in test_unicode_characters()
418 check(r == JSMN_ERROR_INVAL); in test_unicode_characters()
423 check(r == JSMN_ERROR_INVAL); in test_unicode_characters()
428 check(r == JSMN_ERROR_INVAL); in test_unicode_characters()
433 check(r >= 0); in test_unicode_characters()
448 check(r == 3); in test_input_length()
449 check(TOKEN_STRING(js, tokens[0], "{\"a\": 0}")); in test_input_length()
450 check(TOKEN_STRING(js, tokens[1], "a")); in test_input_length()
451 check(TOKEN_STRING(js, tokens[2], "0")); in test_input_length()
462 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 1); in test_count()
466 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 1); in test_count()
470 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 2); in test_count()
474 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 3); in test_count()
478 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 3); in test_count()
482 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 7); in test_count()
486 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 5); in test_count()
490 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 5); in test_count()
494 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 4); in test_count()
498 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 7); in test_count()
513 check(r == 5); in test_keyvalue()
514 check(tokens[0].size == 2); /* two keys */ in test_keyvalue()
515 check(tokens[1].size == 1 && tokens[3].size == 1); /* one value per key */ in test_keyvalue()
516 check(tokens[2].size == 0 && tokens[4].size == 0); /* values have zero size */ in test_keyvalue()
521 check(r == JSMN_ERROR_INVAL); in test_keyvalue()
526 check(r == JSMN_ERROR_INVAL); in test_keyvalue()
531 check(r == JSMN_ERROR_INVAL); in test_keyvalue()
536 check(r == JSMN_ERROR_INVAL); in test_keyvalue()
542 check(r == JSMN_ERROR_INVAL); in test_keyvalue()
578 check(r == 2); in test_nonstrict()
579 check(TOKEN_STRING(js, tokens[0], "a")); in test_nonstrict()
580 check(TOKEN_STRING(js, tokens[1], "0")); in test_nonstrict()
585 check(r == 6); in test_nonstrict()