Lines Matching refs:reporter

23 static void test_clz(skiatest::Reporter* reporter) {
24 REPORTER_ASSERT(reporter, 32 == SkCLZ(0));
25 REPORTER_ASSERT(reporter, 31 == SkCLZ(1));
26 REPORTER_ASSERT(reporter, 1 == SkCLZ(1 << 30));
27 REPORTER_ASSERT(reporter, 1 == SkCLZ((1 << 30) | (1 << 24) | 1));
28 REPORTER_ASSERT(reporter, 0 == SkCLZ(~0U));
38 REPORTER_ASSERT(reporter, intri == porta, "mask:%d intri:%d porta:%d", mask, intri, porta);
42 static void test_ctz(skiatest::Reporter* reporter) {
43 REPORTER_ASSERT(reporter, 32 == SkCTZ(0));
44 REPORTER_ASSERT(reporter, 0 == SkCTZ(1));
45 REPORTER_ASSERT(reporter, 30 == SkCTZ(1 << 30));
46 REPORTER_ASSERT(reporter, 2 == SkCTZ((1 << 30) | (1 << 24) | (1 << 2)));
47 REPORTER_ASSERT(reporter, 0 == SkCTZ(~0U));
57 REPORTER_ASSERT(reporter, intri == porta, "mask:%d intri:%d porta:%d", mask, intri, porta);
77 static void test_floor_value(skiatest::Reporter* reporter, float value) {
81 ERRORF(reporter, "fast_floor(%.9g) == %.9g != %.9g == std_floor(%.9g)",
86 static void test_floor(skiatest::Reporter* reporter) {
92 test_floor_value(reporter, gVals[i]);
93 // test_floor_value(reporter, -gVals[i]);
167 static void check_length(skiatest::Reporter* reporter,
175 REPORTER_ASSERT(reporter, len > 0.999f && len < 1.001f);
178 static void unittest_isfinite(skiatest::Reporter* reporter) {
183 REPORTER_ASSERT(reporter, !SkScalarIsNaN(inf));
184 REPORTER_ASSERT(reporter, !SkScalarIsNaN(-inf));
185 REPORTER_ASSERT(reporter, !SkScalarIsFinite(inf));
186 REPORTER_ASSERT(reporter, !SkScalarIsFinite(-inf));
188 REPORTER_ASSERT(reporter, SkScalarIsNaN(nan));
189 REPORTER_ASSERT(reporter, !SkScalarIsNaN(big));
190 REPORTER_ASSERT(reporter, !SkScalarIsNaN(-big));
191 REPORTER_ASSERT(reporter, !SkScalarIsNaN(0));
193 REPORTER_ASSERT(reporter, !SkScalarIsFinite(nan));
194 REPORTER_ASSERT(reporter, SkScalarIsFinite(big));
195 REPORTER_ASSERT(reporter, SkScalarIsFinite(-big));
196 REPORTER_ASSERT(reporter, SkScalarIsFinite(0));
199 static void unittest_half(skiatest::Reporter* reporter) {
208 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(f, gFloats[i]));
220 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(f, largestPositiveHalf.fF));
225 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(f, largestNegativeHalf.fF));
230 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(f, smallestPositiveHalf.fF));
235 REPORTER_ASSERT(reporter, !SkScalarIsFinite(f) );
240 REPORTER_ASSERT(reporter, f == 0.0f );
245 REPORTER_ASSERT(reporter, !SkScalarIsFinite(f) );
250 REPORTER_ASSERT(reporter, SkScalarIsNaN(f) );
255 static void test_rsqrt(skiatest::Reporter* reporter, RSqrtFn rsqrt) {
264 REPORTER_ASSERT(reporter, relativeError <= maxRelativeError);
274 REPORTER_ASSERT(reporter, relativeError <= maxRelativeError);
284 REPORTER_ASSERT(reporter, relativeError <= maxRelativeError);
331 static void test_muldiv255(skiatest::Reporter* reporter) {
342 REPORTER_ASSERT(reporter, iround == round);
343 REPORTER_ASSERT(reporter, itrunc == trunc);
345 REPORTER_ASSERT(reporter, itrunc <= iround);
346 REPORTER_ASSERT(reporter, iround <= a);
347 REPORTER_ASSERT(reporter, iround <= b);
352 static void test_muldiv255ceiling(skiatest::Reporter* reporter) {
358 REPORTER_ASSERT(reporter, expected_ceiling == webkit_ceiling);
360 REPORTER_ASSERT(reporter, skia_ceiling == webkit_ceiling);
365 static void test_copysign(skiatest::Reporter* reporter) {
379 REPORTER_ASSERT(reporter,
384 REPORTER_ASSERT(reporter, sk_float_copysign(x, y) == expected);
390 REPORTER_ASSERT(reporter, SkCopySign32(ix, ix) == ix);
391 REPORTER_ASSERT(reporter, SkCopySign32(ix, -ix) == -ix);
392 REPORTER_ASSERT(reporter, SkCopySign32(-ix, ix) == ix);
393 REPORTER_ASSERT(reporter, SkCopySign32(-ix, -ix) == -ix);
396 REPORTER_ASSERT(reporter, SkScalarCopySign(sx, sx) == sx);
397 REPORTER_ASSERT(reporter, SkScalarCopySign(sx, -sx) == -sx);
398 REPORTER_ASSERT(reporter, SkScalarCopySign(-sx, sx) == sx);
399 REPORTER_ASSERT(reporter, SkScalarCopySign(-sx, -sx) == -sx);
403 static void huge_vector_normalize(skiatest::Reporter* reporter) {
413 REPORTER_ASSERT(reporter, !v.setLength(1.0f));
418 DEF_TEST(Math, reporter) {
442 test_muldiv255(reporter);
443 test_muldiv255ceiling(reporter);
444 test_copysign(reporter);
448 REPORTER_ASSERT(reporter, SkScalarIsNaN(x));
459 check_length(reporter, p, SK_Scalar1);
463 check_length(reporter, p, SK_Scalar1);
468 REPORTER_ASSERT(reporter, result == SK_Fixed1);
470 REPORTER_ASSERT(reporter, result == 1);
472 REPORTER_ASSERT(reporter, result == 3);
476 REPORTER_ASSERT(reporter, (SkFixedRoundToFixed(-SK_Fixed1 * 10) >> 1) == -SK_Fixed1 * 5);
477 REPORTER_ASSERT(reporter, (SkFixedFloorToFixed(-SK_Fixed1 * 10) >> 1) == -SK_Fixed1 * 5);
478 REPORTER_ASSERT(reporter, (SkFixedCeilToFixed(-SK_Fixed1 * 10) >> 1) == -SK_Fixed1 * 5);
481 huge_vector_normalize(reporter);
482 unittest_isfinite(reporter);
483 unittest_half(reporter);
484 test_rsqrt(reporter, sk_float_rsqrt);
485 test_rsqrt(reporter, sk_float_rsqrt_portable);
486 test_nextlog2(reporter);
497 REPORTER_ASSERT(reporter, result != (SkFixed)SK_NaN32);
504 ERRORF(reporter, "\nFixed Divide: %8x / %8x -> %8x %8" PRIx64 "\n", numer, denom,
507 REPORTER_ASSERT(reporter, result == (int32_t)check);
510 if (false) test_floor(reporter);
515 test_clz(reporter);
516 test_ctz(reporter);
524 DEF_TEST(TestEndian, reporter) {
541 REPORTER_ASSERT(reporter, 0x1122 == SkTEndianSwap16<0x2211>::value);
542 REPORTER_ASSERT(reporter, 0x11223344 == SkTEndianSwap32<0x44332211>::value);
543 REPORTER_ASSERT(reporter, 0x1122334455667788ULL == SkTEndianSwap64<0x8877665544332211ULL>::value);
546 REPORTER_ASSERT(reporter, g16[i].fYang == SkEndianSwap16(g16[i].fYin));
549 REPORTER_ASSERT(reporter, g32[i].fYang == SkEndianSwap32(g32[i].fYin));
552 REPORTER_ASSERT(reporter, g64[i].fYang == SkEndianSwap64(g64[i].fYin));
636 DEF_TEST(GrNextSizePow2, reporter) {
641 test_nextsizepow2(reporter, test, expectedAns);
646 test_nextsizepow2(reporter, test, expectedAns);
651 test_nextsizepow2(reporter, test, expectedAns);
659 test_nextsizepow2(reporter, test, test);
662 test_nextsizepow2(reporter, test, test);
664 test_nextsizepow2(reporter, SIZE_MAX, SIZE_MAX);
667 DEF_TEST(FloatSaturate32, reporter) {
685 REPORTER_ASSERT(reporter, r.fExpectedInt == i);
689 REPORTER_ASSERT(reporter, p >= 0 && p <= 100);
693 DEF_TEST(FloatSaturate64, reporter) {
711 REPORTER_ASSERT(reporter, r.fExpected64 == i);
715 DEF_TEST(DoubleSaturate32, reporter) {
735 REPORTER_ASSERT(reporter, r.fExpectedInt == i);