X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=test_util.cpp;h=047eb11a18a360de615f08249d50a034df64a5fe;hp=aa9cf5651aced8ef9f29e99c2ba3a093d565d3d2;hb=fbe8a2a49401559a456a883d08fe5a7ac9e5f936;hpb=e7389a6a3041dcb1a0a4dceffd2ca9018b49b2f2 diff --git a/test_util.cpp b/test_util.cpp index aa9cf56..047eb11 100644 --- a/test_util.cpp +++ b/test_util.cpp @@ -72,16 +72,22 @@ void expect_equal(const float *ref, const float *result, unsigned width, unsigne { float largest_difference = -1.0f; float squared_difference = 0.0f; + int largest_diff_x = -1, largest_diff_y = -1; for (unsigned y = 0; y < height; ++y) { for (unsigned x = 0; x < width; ++x) { float diff = ref[y * width + x] - result[y * width + x]; - largest_difference = std::max(largest_difference, fabsf(diff)); + if (fabs(diff) > largest_difference) { + largest_difference = fabs(diff); + largest_diff_x = x; + largest_diff_y = y; + } squared_difference += diff * diff; } } - EXPECT_LT(largest_difference, largest_difference_limit); + EXPECT_LT(largest_difference, largest_difference_limit) + << "Largest difference is in x=" << largest_diff_x << ", y=" << largest_diff_y; float rms = sqrt(squared_difference) / (width * height); EXPECT_LT(rms, rms_limit);