Lines Matching refs:Reporter
18 static void test_clz(skiatest::Reporter* reporter) {
19 REPORTER_ASSERT(reporter, 32 == SkCLZ(0));
20 REPORTER_ASSERT(reporter, 31 == SkCLZ(1));
21 REPORTER_ASSERT(reporter, 1 == SkCLZ(1 << 30));
22 REPORTER_ASSERT(reporter, 0 == SkCLZ(~0U));
32 REPORTER_ASSERT(reporter, intri == porta);
52 static void test_floor_value(skiatest::Reporter* reporter, float value) {
56 ERRORF(reporter, "fast_floor(%.9g) == %.9g != %.9g == std_floor(%.9g)",
61 static void test_floor(skiatest::Reporter* reporter) {
67 test_floor_value(reporter, gVals[i]);
68 // test_floor_value(reporter, -gVals[i]);
75 static void test_muldivround(skiatest::Reporter* reporter) {
96 REPORTER_ASSERT(reporter, prod0 == prod1);
168 static void test_blend(skiatest::Reporter* reporter) {
180 ERRORF(reporter, "src:%d dst:%d a:%d "
189 static void check_length(skiatest::Reporter* reporter,
197 REPORTER_ASSERT(reporter, len > 0.999f && len < 1.001f);
223 static void assert_float_equal(skiatest::Reporter* reporter, const char op[],
226 ERRORF(reporter, "%s float %g bits %x native %x skia %x\n",
231 static void test_float_cast(skiatest::Reporter* reporter, float x) {
234 assert_float_equal(reporter, "cast", x, ix, iix);
237 static void test_float_floor(skiatest::Reporter* reporter, float x) {
240 assert_float_equal(reporter, "floor", x, ix, iix);
243 static void test_float_round(skiatest::Reporter* reporter, float x) {
247 assert_float_equal(reporter, "round", x, ix, iix);
250 static void test_float_ceil(skiatest::Reporter* reporter, float x) {
253 assert_float_equal(reporter, "ceil", x, ix, iix);
256 static void test_float_conversions(skiatest::Reporter* reporter, float x) {
257 test_float_cast(reporter, x);
258 test_float_floor(reporter, x);
259 test_float_round(reporter, x);
260 test_float_ceil(reporter, x);
263 static void test_int2float(skiatest::Reporter* reporter, int ival) {
266 REPORTER_ASSERT(reporter, x0 == x1);
269 static void unittest_fastfloat(skiatest::Reporter* reporter) {
279 test_float_conversions(reporter, gFloats[i]);
280 test_float_conversions(reporter, -gFloats[i]);
287 test_float_conversions(reporter, x);
290 test_int2float(reporter, 0);
291 test_int2float(reporter, 1);
292 test_int2float(reporter, -1);
297 test_int2float(reporter, ival);
298 test_int2float(reporter, -ival);
307 static void unittest_isfinite(skiatest::Reporter* reporter) {
312 REPORTER_ASSERT(reporter, !SkScalarIsNaN(inf));
313 REPORTER_ASSERT(reporter, !SkScalarIsNaN(-inf));
314 REPORTER_ASSERT(reporter, !SkScalarIsFinite(inf));
315 REPORTER_ASSERT(reporter, !SkScalarIsFinite(-inf));
317 REPORTER_ASSERT(reporter, SkScalarIsNaN(nan));
318 REPORTER_ASSERT(reporter, !SkScalarIsNaN(big));
319 REPORTER_ASSERT(reporter, !SkScalarIsNaN(-big));
320 REPORTER_ASSERT(reporter, !SkScalarIsNaN(0));
322 REPORTER_ASSERT(reporter, !SkScalarIsFinite(nan));
323 REPORTER_ASSERT(reporter, SkScalarIsFinite(big));
324 REPORTER_ASSERT(reporter, SkScalarIsFinite(-big));
325 REPORTER_ASSERT(reporter, SkScalarIsFinite(0));
328 static void unittest_half(skiatest::Reporter* reporter) {
337 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(f, gFloats[i]));
349 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(f, largestPositiveHalf.fF));
354 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(f, largestNegativeHalf.fF));
359 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(f, smallestPositiveHalf.fF));
364 REPORTER_ASSERT(reporter, !SkScalarIsFinite(f) );
369 REPORTER_ASSERT(reporter, f == 0.0f );
374 REPORTER_ASSERT(reporter, !SkScalarIsFinite(f) );
379 REPORTER_ASSERT(reporter, SkScalarIsNaN(f) );
384 static void test_rsqrt(skiatest::Reporter* reporter, RSqrtFn rsqrt) {
393 REPORTER_ASSERT(reporter, relativeError <= maxRelativeError);
403 REPORTER_ASSERT(reporter, relativeError <= maxRelativeError);
413 REPORTER_ASSERT(reporter, relativeError <= maxRelativeError);
418 static void test_muldiv255(skiatest::Reporter* reporter) {
429 REPORTER_ASSERT(reporter, iround == round);
430 REPORTER_ASSERT(reporter, itrunc == trunc);
432 REPORTER_ASSERT(reporter, itrunc <= iround);
433 REPORTER_ASSERT(reporter, iround <= a);
434 REPORTER_ASSERT(reporter, iround <= b);
439 static void test_muldiv255ceiling(skiatest::Reporter* reporter) {
445 REPORTER_ASSERT(reporter, expected_ceiling == webkit_ceiling);
447 REPORTER_ASSERT(reporter, skia_ceiling == webkit_ceiling);
452 static void test_copysign(skiatest::Reporter* reporter) {
466 REPORTER_ASSERT(reporter,
471 REPORTER_ASSERT(reporter, sk_float_copysign(x, y) == expected);
477 REPORTER_ASSERT(reporter, SkCopySign32(ix, ix) == ix);
478 REPORTER_ASSERT(reporter, SkCopySign32(ix, -ix) == -ix);
479 REPORTER_ASSERT(reporter, SkCopySign32(-ix, ix) == ix);
480 REPORTER_ASSERT(reporter, SkCopySign32(-ix, -ix) == -ix);
483 REPORTER_ASSERT(reporter, SkScalarCopySign(sx, sx) == sx);
484 REPORTER_ASSERT(reporter, SkScalarCopySign(sx, -sx) == -sx);
485 REPORTER_ASSERT(reporter, SkScalarCopySign(-sx, sx) == sx);
486 REPORTER_ASSERT(reporter, SkScalarCopySign(-sx, -sx) == -sx);
490 DEF_TEST(Math, reporter) {
514 test_muldiv255(reporter);
515 test_muldiv255ceiling(reporter);
516 test_copysign(reporter);
520 REPORTER_ASSERT(reporter, SkScalarIsNaN(x));
529 REPORTER_ASSERT(reporter, clamp == clamp2);
540 check_length(reporter, p, SK_Scalar1);
544 check_length(reporter, p, SK_Scalar1);
549 REPORTER_ASSERT(reporter, result == SK_Fixed1);
551 REPORTER_ASSERT(reporter, result == 1);
554 unittest_fastfloat(reporter);
555 unittest_isfinite(reporter);
556 unittest_half(reporter);
557 test_rsqrt(reporter, sk_float_rsqrt);
558 test_rsqrt(reporter, sk_float_rsqrt_portable);
569 REPORTER_ASSERT(reporter, result != (SkFixed)SK_NaN32);
576 ERRORF(reporter, "\nFixed Divide: %8x / %8x -> %8x %8x\n", numer, denom, result, check);
578 REPORTER_ASSERT(reporter, result == (int32_t)check);
581 test_blend(reporter);
583 if (false) test_floor(reporter);
588 test_muldivround(reporter);
589 test_clz(reporter);
597 DEF_TEST(TestEndian, reporter) {
614 REPORTER_ASSERT(reporter, 0x1122 == SkTEndianSwap16<0x2211>::value);
615 REPORTER_ASSERT(reporter, 0x11223344 == SkTEndianSwap32<0x44332211>::value);
616 REPORTER_ASSERT(reporter, 0x1122334455667788ULL == SkTEndianSwap64<0x8877665544332211ULL>::value);
619 REPORTER_ASSERT(reporter, g16[i].fYang == SkEndianSwap16(g16[i].fYin));
622 REPORTER_ASSERT(reporter, g32[i].fYang == SkEndianSwap32(g32[i].fYin));
625 REPORTER_ASSERT(reporter, g64[i].fYang == SkEndianSwap64(g64[i].fYin));
630 static void test_divmod(skiatest::Reporter* r) {