Lines Matching refs:tok
117 jsmntok_t tok[10]; in test_primitive() local
122 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_primitive()
123 check(r >= 0 && tok[0].type == JSMN_STRING in test_primitive()
124 && tok[1].type == JSMN_PRIMITIVE); 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()
130 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_primitive()
131 check(r >= 0 && tok[0].type == JSMN_STRING in test_primitive()
132 && tok[1].type == JSMN_PRIMITIVE); 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()
138 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_primitive()
139 check(r >= 0 && tok[0].type == JSMN_STRING in test_primitive()
140 && tok[1].type == JSMN_PRIMITIVE); 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()
146 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_primitive()
147 check(r >= 0 && tok[0].type == JSMN_STRING in test_primitive()
148 && tok[1].type == JSMN_PRIMITIVE); 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()
154 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_primitive()
155 check(r >= 0 && tok[0].type == JSMN_STRING in test_primitive()
156 && tok[1].type == JSMN_PRIMITIVE); 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()
166 jsmntok_t tok[10]; in test_string() local
171 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_string()
172 check(r >= 0 && tok[0].type == JSMN_STRING in test_string()
173 && tok[1].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()
179 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_string()
180 check(r >= 0 && tok[0].type == JSMN_STRING in test_string()
181 && tok[1].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()
187 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_string()
188 check(r >= 0 && tok[0].type == JSMN_STRING in test_string()
189 && tok[1].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()
199 jsmntok_t tok[10]; in test_partial_string() local
204 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_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()
210 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_string()
211 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_STRING); in test_partial_string()
212 check(TOKEN_STRING(js, tok[0], "x")); in test_partial_string()
216 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_string()
217 check(r >= 0 && tok[0].type == JSMN_STRING in test_partial_string()
218 && tok[1].type == JSMN_STRING); 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()
223 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_string()
224 check(r >= 0 && tok[0].type == JSMN_STRING in test_partial_string()
225 && tok[1].type == JSMN_STRING && tok[2].type == JSMN_STRING in test_partial_string()
226 && tok[3].type == JSMN_STRING); 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()
239 jsmntok_t tok[10]; in test_unquoted_keys() local
245 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_unquoted_keys()
246 check(r >= 0 && tok[0].type == JSMN_PRIMITIVE in test_unquoted_keys()
247 && tok[1].type == JSMN_STRING && tok[2].type == JSMN_PRIMITIVE in test_unquoted_keys()
248 && tok[3].type == JSMN_PRIMITIVE); 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()
260 jsmntok_t tok[10]; in test_partial_array() local
265 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_array()
266 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_ARRAY in test_partial_array()
267 && tok[1].type == JSMN_PRIMITIVE && tok[2].type == JSMN_PRIMITIVE); in test_partial_array()
270 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_array()
271 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_ARRAY in test_partial_array()
272 && tok[1].type == JSMN_PRIMITIVE && tok[2].type == JSMN_PRIMITIVE in test_partial_array()
273 && tok[3].type == JSMN_ARRAY && tok[4].type == JSMN_PRIMITIVE); in test_partial_array()
276 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_array()
277 check(r == JSMN_ERROR_PART && tok[0].type == JSMN_ARRAY in test_partial_array()
278 && tok[1].type == JSMN_PRIMITIVE && tok[2].type == JSMN_PRIMITIVE in test_partial_array()
279 && tok[3].type == JSMN_ARRAY && tok[4].type == JSMN_PRIMITIVE in test_partial_array()
280 && tok[5].type == JSMN_STRING); in test_partial_array()
282 check(tok[3].size == 2); in test_partial_array()
285 r = jsmn_parse(&p, js, strlen(js), tok, 10); in test_partial_array()
286 check(r >= 0 && tok[0].type == JSMN_ARRAY in test_partial_array()
287 && tok[1].type == JSMN_PRIMITIVE && tok[2].type == JSMN_PRIMITIVE in test_partial_array()
288 && tok[3].type == JSMN_ARRAY && tok[4].type == JSMN_PRIMITIVE in test_partial_array()
289 && tok[5].type == JSMN_STRING); in test_partial_array()
290 check(tok[3].size == 2); in test_partial_array()
291 check(tok[0].size == 3); in test_partial_array()