static void test_floatclass(skiatest::Reporter* reporter, float value, FloatClass fc) { // our sk_float_is... function may return int instead of bool, // hence the double ! to turn it into a bool REPORTER_ASSERT(reporter, !!sk_float_isfinite(value) == (fc == kFinite)); REPORTER_ASSERT(reporter, !!sk_float_isinf(value) == (fc == kInfinite)); REPORTER_ASSERT(reporter, !!sk_float_isnan(value) == (fc == kNaN)); }
static bool are_equal(skiatest::Reporter* reporter, const SkMatrix& a, const SkMatrix& b) { bool equal = a == b; bool cheapEqual = a.cheapEqualTo(b); if (equal != cheapEqual) { #ifdef SK_SCALAR_IS_FLOAT if (equal) { bool foundZeroSignDiff = false; for (int i = 0; i < 9; ++i) { float aVal = a.get(i); float bVal = b.get(i); int aValI = *SkTCast<int*>(&aVal); int bValI = *SkTCast<int*>(&bVal); if (0 == aVal && 0 == bVal && aValI != bValI) { foundZeroSignDiff = true; } else { REPORTER_ASSERT(reporter, aVal == bVal && aValI == aValI); } } REPORTER_ASSERT(reporter, foundZeroSignDiff); } else { bool foundNaN = false; for (int i = 0; i < 9; ++i) { float aVal = a.get(i); float bVal = b.get(i); int aValI = *SkTCast<int*>(&aVal); int bValI = *SkTCast<int*>(&bVal); if (sk_float_isnan(aVal) && aValI == bValI) { foundNaN = true; } else { REPORTER_ASSERT(reporter, aVal == bVal && aValI == bValI); } } REPORTER_ASSERT(reporter, foundNaN); } #else REPORTER_ASSERT(reporter, false); #endif } return equal; }