Lines Matching refs:reporter
17 DEF_TEST(JSON_Parse, reporter) { in DEF_TEST() argument
136 REPORTER_ASSERT(reporter, success == (tst.out != nullptr)); in DEF_TEST()
144 REPORTER_ASSERT(reporter, !strcmp(tst.out, static_cast<const char*>(data->data()))); in DEF_TEST()
150 static void check_primitive(skiatest::Reporter* reporter, const Value& v, T pv, in check_primitive() argument
153 REPORTER_ASSERT(reporter, v.is<VT>() == is_type); in check_primitive()
155 REPORTER_ASSERT(reporter, (cast_t != nullptr) == is_type); in check_primitive()
158 REPORTER_ASSERT(reporter, &v.as<VT>() == cast_t); in check_primitive()
159 REPORTER_ASSERT(reporter, *v.as<VT>() == pv); in check_primitive()
164 static void check_vector(skiatest::Reporter* reporter, const Value& v, size_t expected_size, in check_vector() argument
166 REPORTER_ASSERT(reporter, v.is<T>() == is_vector); in check_vector()
168 REPORTER_ASSERT(reporter, (cast_t != nullptr) == is_vector); in check_vector()
172 REPORTER_ASSERT(reporter, &vec == cast_t); in check_vector()
173 REPORTER_ASSERT(reporter, vec.size() == expected_size); in check_vector()
174 REPORTER_ASSERT(reporter, vec.begin() != nullptr); in check_vector()
175 REPORTER_ASSERT(reporter, vec.end() == vec.begin() + expected_size); in check_vector()
179 static void check_string(skiatest::Reporter* reporter, const Value& v, const char* s) { in check_string() argument
180 check_vector<StringValue>(reporter, v, s ? strlen(s) : 0, !!s); in check_string()
182 REPORTER_ASSERT(reporter, !strcmp(v.as<StringValue>().begin(), s)); in check_string()
186 DEF_TEST(JSON_DOM_visit, reporter) { in DEF_TEST() argument
201 REPORTER_ASSERT(reporter, jroot.is<ObjectValue>()); in DEF_TEST()
205 REPORTER_ASSERT(reporter, v.is<NullValue>()); in DEF_TEST()
207 check_primitive<bool, BoolValue>(reporter, v, false, false); in DEF_TEST()
208 check_primitive<float, NumberValue>(reporter, v, 0, false); in DEF_TEST()
210 check_string(reporter, v, nullptr); in DEF_TEST()
211 check_vector<ArrayValue >(reporter, v, 0, false); in DEF_TEST()
212 check_vector<ObjectValue>(reporter, v, 0, false); in DEF_TEST()
217 REPORTER_ASSERT(reporter, !v.is<NullValue>()); in DEF_TEST()
219 check_primitive<bool, BoolValue>(reporter, v, false, true); in DEF_TEST()
220 check_primitive<float, NumberValue>(reporter, v, 0, false); in DEF_TEST()
222 check_string(reporter, v, nullptr); in DEF_TEST()
223 check_vector<ArrayValue >(reporter, v, 0, false); in DEF_TEST()
224 check_vector<ObjectValue>(reporter, v, 0, false); in DEF_TEST()
229 REPORTER_ASSERT(reporter, !v.is<NullValue>()); in DEF_TEST()
231 check_primitive<bool, BoolValue>(reporter, v, true, true); in DEF_TEST()
232 check_primitive<float, NumberValue>(reporter, v, 0, false); in DEF_TEST()
234 check_string(reporter, v, nullptr); in DEF_TEST()
235 check_vector<ArrayValue >(reporter, v, 0, false); in DEF_TEST()
236 check_vector<ObjectValue>(reporter, v, 0, false); in DEF_TEST()
241 REPORTER_ASSERT(reporter, !v.is<NullValue>()); in DEF_TEST()
243 check_primitive<bool, BoolValue>(reporter, v, false, false); in DEF_TEST()
244 check_primitive<float, NumberValue>(reporter, v, 42, true); in DEF_TEST()
246 check_string(reporter, v, nullptr); in DEF_TEST()
247 check_vector<ArrayValue >(reporter, v, 0, false); in DEF_TEST()
248 check_vector<ObjectValue>(reporter, v, 0, false); in DEF_TEST()
253 REPORTER_ASSERT(reporter, !v.is<NullValue>()); in DEF_TEST()
255 check_primitive<bool, BoolValue>(reporter, v, false, false); in DEF_TEST()
256 check_primitive<float, NumberValue>(reporter, v, .75f, true); in DEF_TEST()
258 check_string(reporter, v, nullptr); in DEF_TEST()
259 check_vector<ArrayValue >(reporter, v, 0, false); in DEF_TEST()
260 check_vector<ObjectValue>(reporter, v, 0, false); in DEF_TEST()
265 REPORTER_ASSERT(reporter, !v.is<NullValue>()); in DEF_TEST()
267 check_primitive<bool, BoolValue>(reporter, v, false, false); in DEF_TEST()
268 check_primitive<float, NumberValue>(reporter, v, 0, false); in DEF_TEST()
270 check_string(reporter, v, "foo"); in DEF_TEST()
271 check_vector<ArrayValue >(reporter, v, 0, false); in DEF_TEST()
272 check_vector<ObjectValue>(reporter, v, 0, false); in DEF_TEST()
277 REPORTER_ASSERT(reporter, !v.is<NullValue>()); in DEF_TEST()
279 check_primitive<bool, BoolValue>(reporter, v, false, false); in DEF_TEST()
280 check_primitive<float, NumberValue>(reporter, v, 0, false); in DEF_TEST()
282 check_string(reporter, v, nullptr); in DEF_TEST()
283 check_vector<ObjectValue>(reporter, v, 0, false); in DEF_TEST()
285 check_vector<ArrayValue >(reporter, v, 3, true); in DEF_TEST()
286 check_primitive<float, NumberValue>(reporter, v.as<ArrayValue>()[0], 1, true); in DEF_TEST()
287 check_primitive<bool, BoolValue>(reporter, v.as<ArrayValue>()[1], true, true); in DEF_TEST()
288 check_vector<StringValue>(reporter, v.as<ArrayValue>()[2], 3, true); in DEF_TEST()
293 REPORTER_ASSERT(reporter, !v.is<NullValue>()); in DEF_TEST()
295 check_primitive<bool, BoolValue>(reporter, v, false, false); in DEF_TEST()
296 check_primitive<float, NumberValue>(reporter, v, 0, false); in DEF_TEST()
298 check_string(reporter, v, nullptr); in DEF_TEST()
299 check_vector<ArrayValue >(reporter, v, 0, false); in DEF_TEST()
301 check_vector<ObjectValue>(reporter, v, 3, true); in DEF_TEST()
304 check_string(reporter, m0.fKey, "kk1"); in DEF_TEST()
305 check_primitive<float, NumberValue>(reporter, m0.fValue, 2, true); in DEF_TEST()
308 check_string(reporter, m1.fKey, "kk2"); in DEF_TEST()
309 check_primitive<bool, BoolValue>(reporter, m1.fValue, false, true); in DEF_TEST()
312 check_string(reporter, m2.fKey, "kk1"); in DEF_TEST()
313 check_string(reporter, m2.fValue, "baz"); in DEF_TEST()
315 REPORTER_ASSERT(reporter, v.as<ObjectValue>()[""].is<NullValue>()); in DEF_TEST()
316 REPORTER_ASSERT(reporter, v.as<ObjectValue>()["nosuchkey"].is<NullValue>()); in DEF_TEST()
317 check_string(reporter, v.as<ObjectValue>()["kk1"], "baz"); in DEF_TEST()
318 check_primitive<bool, BoolValue>(reporter, v.as<ObjectValue>()["kk2"], false, true); in DEF_TEST()
323 void check_value(skiatest::Reporter* reporter, const Value& v, const char* expected_string) { in check_value() argument
324 REPORTER_ASSERT(reporter, v.is<T>()); in check_value()
327 REPORTER_ASSERT(reporter, cast_t == &v.as<T>()); in check_value()
330 REPORTER_ASSERT(reporter, 0 == strcmp(expected_string, vstr.c_str())); in check_value()
333 DEF_TEST(JSON_DOM_build, reporter) { in DEF_TEST() argument
337 check_value<NullValue>(reporter, v0, "null"); in DEF_TEST()
340 check_value<BoolValue>(reporter, v1, "true"); in DEF_TEST()
343 check_value<BoolValue>(reporter, v2, "false"); in DEF_TEST()
346 check_value<NumberValue>(reporter, v3, "0"); in DEF_TEST()
349 check_value<NumberValue>(reporter, v4, "42"); in DEF_TEST()
352 check_value<NumberValue>(reporter, v5, "42.75"); in DEF_TEST()
355 check_value<StringValue>(reporter, v6, "\"\""); in DEF_TEST()
358 check_value<StringValue>(reporter, v7, "\" foo \""); in DEF_TEST()
361 check_value<StringValue>(reporter, v8, "\" foo bar baz \""); in DEF_TEST()
364 check_value<ArrayValue>(reporter, v9, "[]"); in DEF_TEST()
368 check_value<ArrayValue>(reporter, v10, "[null,0,[]]"); in DEF_TEST()
371 check_value<ObjectValue>(reporter, v11, "{}"); in DEF_TEST()
379 check_value<ObjectValue>(reporter, v12, "{" in DEF_TEST()
387 check_value<ArrayValue>(reporter, v13, "[" in DEF_TEST()
403 check_value<ObjectValue>(reporter, v14, "{" in DEF_TEST()
418 DEF_TEST(JSON_ParseNumber, reporter) { in DEF_TEST() argument
450 REPORTER_ASSERT(reporter, jroot); in DEF_TEST()
453 REPORTER_ASSERT(reporter, jnumber); in DEF_TEST()
454 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(**jnumber, test.value, test.tolerance)); in DEF_TEST()