Lines Matching defs:check

15 #define check(cond) do { if (!(cond)) fail(); } while (0)
53 check(r >= 0);
54 check(t[0].type == JSMN_OBJECT);
55 check(t[0].start == 0 && t[0].end == 2);
60 check(r >= 0);
61 check(t[0].type == JSMN_ARRAY);
62 check(t[0].start == 0 && t[0].end == 2);
67 check(r >= 0);
68 check(t[0].type == JSMN_OBJECT && t[0].start == 0 && t[0].end == 8);
69 check(t[1].type == JSMN_STRING && t[1].start == 2 && t[1].end == 3);
70 check(t[2].type == JSMN_ARRAY && t[2].start == 5 && t[2].end == 7);
75 check(r >= 0);
76 check(t[0].type == JSMN_ARRAY && t[0].start == 0 && t[0].end == 7);
77 check(t[1].type == JSMN_OBJECT && t[1].start == 1 && t[1].end == 3);
78 check(t[2].type == JSMN_OBJECT && t[2].start == 4 && t[2].end == 6);
92 check(r >= 0);
93 check(TOKEN_EQ(tokens[0], 0, 8, JSMN_OBJECT));
94 check(TOKEN_EQ(tokens[1], 2, 3, JSMN_STRING));
95 check(TOKEN_EQ(tokens[2], 6, 7, JSMN_PRIMITIVE));
97 check(TOKEN_STRING(js, tokens[0], js));
98 check(TOKEN_STRING(js, tokens[1], "a"));
99 check(TOKEN_STRING(js, tokens[2], "0"));
104 check(r >= 0);
109 check(r >= 0);
123 check(r >= 0 && tok[0].type == JSMN_STRING
125 check(TOKEN_STRING(js, tok[0], "boolVar"));
126 check(TOKEN_STRING(js, tok[1], "true"));
131 check(r >= 0 && tok[0].type == JSMN_STRING
133 check(TOKEN_STRING(js, tok[0], "boolVar"));
134 check(TOKEN_STRING(js, tok[1], "false"));
139 check(r >= 0 && tok[0].type == JSMN_STRING
141 check(TOKEN_STRING(js, tok[0], "intVar"));
142 check(TOKEN_STRING(js, tok[1], "12345"));
147 check(r >= 0 && tok[0].type == JSMN_STRING
149 check(TOKEN_STRING(js, tok[0], "floatVar"));
150 check(TOKEN_STRING(js, tok[1], "12.345"));
155 check(r >= 0 && tok[0].type == JSMN_STRING
157 check(TOKEN_STRING(js, tok[0], "nullVar"));
158 check(TOKEN_STRING(js, tok[1], "null"));
172 check(r >= 0 && tok[0].type == JSMN_STRING
174 check(TOKEN_STRING(js, tok[0], "strVar"));
175 check(TOKEN_STRING(js, tok[1], "hello world"));
180 check(r >= 0 && tok[0].type == JSMN_STRING
182 check(TOKEN_STRING(js, tok[0], "strVar"));
183 check(TOKEN_STRING(js, tok[1], "escapes: \\/\\r\\n\\t\\b\\f\\\"\\\\"));
188 check(r >= 0 && tok[0].type == JSMN_STRING
190 check(TOKEN_STRING(js, tok[0], "strVar"));
191 check(TOKEN_STRING(js, tok[1], ""));
205 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_STRING);
206 check(TOKEN_STRING(js, tok[0], "x"));
207 check(p.toknext == 1);
212 check(r == JSMN_ERROR_PART);
217 check(r == JSMN_ERROR_PART);
221 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_STRING);
222 check(TOKEN_STRING(js, tok[0], "x"));
223 check(p.toknext == 1);
227 check(r >= 0 && tok[0].type == JSMN_STRING
229 check(TOKEN_STRING(js, tok[0], "x"));
230 check(TOKEN_STRING(js, tok[1], "value"));
234 check(r >= 0 && tok[0].type == JSMN_STRING
237 check(TOKEN_STRING(js, tok[0], "x"));
238 check(TOKEN_STRING(js, tok[1], "value"));
239 check(TOKEN_STRING(js, tok[2], "y"));
240 check(TOKEN_STRING(js, tok[3], "value y"));
256 check(r >= 0 && tok[0].type == JSMN_PRIMITIVE
259 check(TOKEN_STRING(js, tok[0], "key1"));
260 check(TOKEN_STRING(js, tok[1], "value"));
261 check(TOKEN_STRING(js, tok[2], "key2"));
262 check(TOKEN_STRING(js, tok[3], "123"));
276 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_ARRAY
281 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_ARRAY
287 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_ARRAY
291 /* check child nodes of the 2nd array */
292 check(tok[3].size == 2);
296 check(r >= 0 && tok[0].type == JSMN_ARRAY
300 check(tok[3].size == 2);
301 check(tok[0].size == 3);
319 check(r == JSMN_ERROR_NOMEM);
324 check(r >= 0);
326 check(toklarge[0].type == JSMN_ARRAY && toklarge[0].size == 3);
327 check(toklarge[3].type == JSMN_ARRAY && toklarge[3].size == 2);
341 check(r == JSMN_ERROR_INVAL);
346 check(r >= 0);
351 check(r == JSMN_ERROR_INVAL);
356 check(r >= 0);
377 check(r >= 0);
403 check(r >= 0);
408 check(r >= 0);
413 check(r >= 0);
418 check(r == JSMN_ERROR_INVAL);
423 check(r == JSMN_ERROR_INVAL);
428 check(r == JSMN_ERROR_INVAL);
433 check(r >= 0);
448 check(r == 3);
449 check(TOKEN_STRING(js, tokens[0], "{\"a\": 0}"));
450 check(TOKEN_STRING(js, tokens[1], "a"));
451 check(TOKEN_STRING(js, tokens[2], "0"));
462 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 1);
466 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 1);
470 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 2);
474 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 3);
478 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 3);
482 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 7);
486 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 5);
490 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 5);
494 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 4);
498 check(jsmn_parse(&p, js, strlen(js), NULL, 0) == 7);
513 check(r == 5);
514 check(tokens[0].size == 2); /* two keys */
515 check(tokens[1].size == 1 && tokens[3].size == 1); /* one value per key */
516 check(tokens[2].size == 0 && tokens[4].size == 0); /* values have zero size */
521 check(r == JSMN_ERROR_INVAL);
526 check(r == JSMN_ERROR_INVAL);
531 check(r == JSMN_ERROR_INVAL);
536 check(r == JSMN_ERROR_INVAL);
542 check(r == JSMN_ERROR_INVAL);
578 check(r == 2);
579 check(TOKEN_STRING(js, tokens[0], "a"));
580 check(TOKEN_STRING(js, tokens[1], "0"));
585 check(r == 6);