Home | History | Annotate | Download | only in tests

Lines Matching refs:Reporter

22 static void test_clz(skiatest::Reporter* reporter) {
23 REPORTER_ASSERT(reporter, 32 == SkCLZ(0));
24 REPORTER_ASSERT(reporter, 31 == SkCLZ(1));
25 REPORTER_ASSERT(reporter, 1 == SkCLZ(1 << 30));
26 REPORTER_ASSERT(reporter, 0 == SkCLZ(~0U));
36 REPORTER_ASSERT(reporter, intri == porta);
40 static void test_quick_div(skiatest::Reporter* reporter) {
51 REPORTER_ASSERT(reporter, table[i] == gFDot6INVERSE[i + kInverseTableSize]);
63 REPORTER_ASSERT(reporter,
88 static void test_floor_value(skiatest::Reporter* reporter, float value) {
92 ERRORF(reporter, "fast_floor(%.9g) == %.9g != %.9g == std_floor(%.9g)",
97 static void test_floor(skiatest::Reporter* reporter) {
103 test_floor_value(reporter, gVals[i]);
104 // test_floor_value(reporter, -gVals[i]);
111 static void test_muldivround(skiatest::Reporter* reporter) {
132 REPORTER_ASSERT(reporter, prod0 == prod1);
204 static void test_blend(skiatest::Reporter* reporter) {
216 ERRORF(reporter, "src:%d dst:%d a:%d "
225 static void check_length(skiatest::Reporter* reporter,
233 REPORTER_ASSERT(reporter, len > 0.999f && len < 1.001f);
260 static void assert_float_equal(skiatest::Reporter* reporter, const char op[],
263 ERRORF(reporter, "%s float %g bits %x native %x skia %x\n",
268 static void test_float_floor(skiatest::Reporter* reporter, float x) {
271 assert_float_equal(reporter, "floor", x, ix, iix);
274 static void test_float_round(skiatest::Reporter* reporter, float x) {
278 assert_float_equal(reporter, "round", x, ix, iix);
281 static void test_float_ceil(skiatest::Reporter* reporter, float x) {
284 assert_float_equal(reporter, "ceil", x, ix, iix);
287 static void test_float_conversions(skiatest::Reporter* reporter, float x) {
288 test_float_floor(reporter, x);
289 test_float_round(reporter, x);
290 test_float_ceil(reporter, x);
293 static void unittest_fastfloat(skiatest::Reporter* reporter) {
304 test_float_conversions(reporter, gFloats[i]);
305 test_float_conversions(reporter, -gFloats[i]);
312 test_float_conversions(reporter, x);
321 static void unittest_isfinite(skiatest::Reporter* reporter) {
326 REPORTER_ASSERT(reporter, !SkScalarIsNaN(inf));
327 REPORTER_ASSERT(reporter, !SkScalarIsNaN(-inf));
328 REPORTER_ASSERT(reporter, !SkScalarIsFinite(inf));
329 REPORTER_ASSERT(reporter, !SkScalarIsFinite(-inf));
331 REPORTER_ASSERT(reporter, SkScalarIsNaN(nan));
332 REPORTER_ASSERT(reporter, !SkScalarIsNaN(big));
333 REPORTER_ASSERT(reporter, !SkScalarIsNaN(-big));
334 REPORTER_ASSERT(reporter, !SkScalarIsNaN(0));
336 REPORTER_ASSERT(reporter, !SkScalarIsFinite(nan));
337 REPORTER_ASSERT(reporter, SkScalarIsFinite(big));
338 REPORTER_ASSERT(reporter, SkScalarIsFinite(-big));
339 REPORTER_ASSERT(reporter, SkScalarIsFinite(0));
342 static void unittest_half(skiatest::Reporter* reporter) {
351 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(f, gFloats[i]));
363 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(f, largestPositiveHalf.fF));
368 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(f, largestNegativeHalf.fF));
373 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(f, smallestPositiveHalf.fF));
378 REPORTER_ASSERT(reporter, !SkScalarIsFinite(f) );
383 REPORTER_ASSERT(reporter, f == 0.0f );
388 REPORTER_ASSERT(reporter, !SkScalarIsFinite(f) );
393 REPORTER_ASSERT(reporter, SkScalarIsNaN(f) );
398 static void test_rsqrt(skiatest::Reporter* reporter, RSqrtFn rsqrt) {
407 REPORTER_ASSERT(reporter, relativeError <= maxRelativeError);
417 REPORTER_ASSERT(reporter, relativeError <= maxRelativeError);
427 REPORTER_ASSERT(reporter, relativeError <= maxRelativeError);
432 static void test_muldiv255(skiatest::Reporter* reporter) {
443 REPORTER_ASSERT(reporter, iround == round);
444 REPORTER_ASSERT(reporter, itrunc == trunc);
446 REPORTER_ASSERT(reporter, itrunc <= iround);
447 REPORTER_ASSERT(reporter, iround <= a);
448 REPORTER_ASSERT(reporter, iround <= b);
453 static void test_muldiv255ceiling(skiatest::Reporter* reporter) {
459 REPORTER_ASSERT(reporter, expected_ceiling == webkit_ceiling);
461 REPORTER_ASSERT(reporter, skia_ceiling == webkit_ceiling);
466 static void test_copysign(skiatest::Reporter* reporter) {
480 REPORTER_ASSERT(reporter,
485 REPORTER_ASSERT(reporter, sk_float_copysign(x, y) == expected);
491 REPORTER_ASSERT(reporter, SkCopySign32(ix, ix) == ix);
492 REPORTER_ASSERT(reporter, SkCopySign32(ix, -ix) == -ix);
493 REPORTER_ASSERT(reporter, SkCopySign32(-ix, ix) == ix);
494 REPORTER_ASSERT(reporter, SkCopySign32(-ix, -ix) == -ix);
497 REPORTER_ASSERT(reporter, SkScalarCopySign(sx, sx) == sx);
498 REPORTER_ASSERT(reporter, SkScalarCopySign(sx, -sx) == -sx);
499 reporter, SkScalarCopySign(-sx, sx) == sx);
500 REPORTER_ASSERT(reporter, SkScalarCopySign(-sx, -sx) == -sx);
504 DEF_TEST(Math, reporter) {
528 test_muldiv255(reporter);
529 test_muldiv255ceiling(reporter);
530 test_copysign(reporter);
534 REPORTER_ASSERT(reporter, SkScalarIsNaN(x));
543 REPORTER_ASSERT(reporter, clamp == clamp2);
554 check_length(reporter, p, SK_Scalar1);
558 check_length(reporter, p, SK_Scalar1);
563 REPORTER_ASSERT(reporter, result == SK_Fixed1);
565 REPORTER_ASSERT(reporter, result == 1);
567 REPORTER_ASSERT(reporter, result == 3);
571 REPORTER_ASSERT(reporter, (SkFixedRoundToFixed(-SK_Fixed1 * 10) >> 1) == -SK_Fixed1 * 5);
572 REPORTER_ASSERT(reporter, (SkFixedFloorToFixed(-SK_Fixed1 * 10) >> 1) == -SK_Fixed1 * 5);
573 REPORTER_ASSERT(reporter, (SkFixedCeilToFixed(-SK_Fixed1 * 10) >> 1) == -SK_Fixed1 * 5);
576 unittest_fastfloat(reporter);
577 unittest_isfinite(reporter);
578 unittest_half(reporter);
579 test_rsqrt(reporter, sk_float_rsqrt);
580 test_rsqrt(reporter, sk_float_rsqrt_portable);
591 REPORTER_ASSERT(reporter, result != (SkFixed)SK_NaN32);
598 ERRORF(reporter, "\nFixed Divide: %8x / %8x -> %8x %8x\n", numer, denom, result, check);
600 REPORTER_ASSERT(reporter, result == (int32_t)check);
603 test_blend(reporter);
605 if (false) test_floor(reporter);
610 test_muldivround(reporter);
611 test_clz(reporter);
612 test_quick_div(reporter);
620 DEF_TEST(TestEndian, reporter) {
637 REPORTER_ASSERT(reporter, 0x1122 == SkTEndianSwap16<0x2211>::value);
638 REPORTER_ASSERT(reporter, 0x11223344 == SkTEndianSwap32<0x44332211>::value);
639 REPORTER_ASSERT(reporter, 0x1122334455667788ULL == SkTEndianSwap64<0x8877665544332211ULL>::value);
642 REPORTER_ASSERT(reporter, g16[i].fYang == SkEndianSwap16(g16[i].fYin));
645 REPORTER_ASSERT(reporter, g32[i].fYang == SkEndianSwap32(g32[i].fYin));
648 REPORTER_ASSERT(reporter, g64[i].fYang == SkEndianSwap64(g64[i].fYin));
653 static void test_divmod(skiatest::Reporter* r) {
723 static void test_nextsizepow2(skiatest::Reporter* r, size_t test, size_t expectedAns) {
730 DEF_TEST(GrNextSizePow2, reporter) {
735 test_nextsizepow2(reporter, test, expectedAns);
740 test_nextsizepow2(reporter, test, expectedAns);
745 test_nextsizepow2(reporter, test, expectedAns);
753 test_nextsizepow2(reporter, test, test);
756 test_nextsizepow2(reporter, test, test);
758 test_nextsizepow2(reporter, SIZE_MAX, SIZE_MAX);