diff --git a/u02/src/tests.cpp b/u02/src/tests.cpp index 97862b7..2fc9cd0 100644 --- a/u02/src/tests.cpp +++ b/u02/src/tests.cpp @@ -352,7 +352,7 @@ TEST_CASE("Bresenham circle (prop: √(x²+y²)-r<ε)") { SKIP("All coordinates have extreme value, skipping (avoid rounding error)"); } - const int r = + const float r = round(std::sqrt(std::pow((x1 - x0), 2) + std::pow((y1 - y0), 2))); canvas_buffer *canvas = new canvas_buffer(size, size); @@ -363,7 +363,7 @@ TEST_CASE("Bresenham circle (prop: √(x²+y²)-r<ε)") { bool pass = true; for (int x = 0; x < size; x++) { for (int y = 0; y < size; y++) { - double distance = + float distance = std::abs(std::sqrt(std::pow(x0 - x, 2) + std::pow(y0 - y, 2)) - r); // Because of rounding errors, an exact test (for all pixels) is not // feasible.