[FIX] clang-tidy issue

This commit is contained in:
NADAL Jean-Baptiste
2024-02-14 11:42:56 +01:00
parent a9520b89f1
commit d019402756
4 changed files with 28 additions and 3 deletions

View File

@@ -107,7 +107,6 @@ std::string Canvas::to_ppm(void)
add_color_component(the_result, the_col_number, the_color.blue_to_integer()); add_color_component(the_result, the_col_number, the_color.blue_to_integer());
} }
the_result += "\n"; the_result += "\n";
the_col_number = 0;
} }
return the_result; return the_result;

View File

@@ -271,6 +271,10 @@ SCENARIO("Adding two tuples without modify a1", "[features/tuples.feature]")
{ {
REQUIRE((a1 + a2) == Tuple(1, 1, 6, 1)); REQUIRE((a1 + a2) == Tuple(1, 1, 6, 1));
} }
AND_THEN("a3 = a1 + a2")
{
REQUIRE((a1 + a2) == a3);
}
} }
} }
} }
@@ -312,6 +316,10 @@ SCENARIO("Subtracting two points without modify p1", "[features/tuples.feature]"
{ {
REQUIRE((p1 - p2) == Tuple::Vector(-2, -4, -6)); REQUIRE((p1 - p2) == Tuple::Vector(-2, -4, -6));
} }
AND_THEN("p3 = p1 - p2")
{
REQUIRE((p1 - p2) == p3);
}
} }
} }
} }
@@ -414,6 +422,10 @@ SCENARIO("Multiplying a tuple by a scalar without modify a", "[features/tuples.f
{ {
REQUIRE(a * 3.5 == Tuple(3.5, -7, 10.5, -14)); REQUIRE(a * 3.5 == Tuple(3.5, -7, 10.5, -14));
} }
AND_THEN("b = a * 3.5")
{
REQUIRE((a * 3.5) == b);
}
} }
} }
} }
@@ -460,6 +472,10 @@ SCENARIO("Dividing a tuple by a scalar without modify a", "[features/tuples.feat
{ {
REQUIRE(a / 2 == Tuple(0.5, -1, 1.5, -2)); REQUIRE(a / 2 == Tuple(0.5, -1, 1.5, -2));
} }
AND_THEN("b = a / 2")
{
REQUIRE((a / 2) == b);
}
} }
} }
} }

View File

@@ -119,6 +119,10 @@ SCENARIO("Adding colors without modify c1", "[features/tuples.feature]")
{ {
REQUIRE((c1 + c2) == Color(1.6, 0.7, 1.0)); REQUIRE((c1 + c2) == Color(1.6, 0.7, 1.0));
} }
AND_THEN("c3 = c1 + c2")
{
REQUIRE(c3 == c1 + c2);
}
} }
} }
} }
@@ -160,6 +164,10 @@ SCENARIO("Subtracting colors without modify c1", "[features/tuples.feature]")
{ {
REQUIRE((c1 - c2) == Color(0.2, 0.5, 0.5)); REQUIRE((c1 - c2) == Color(0.2, 0.5, 0.5));
} }
AND_THEN("c3 = c1 - c2")
{
REQUIRE(c3 == c1 - c2);
}
} }
} }
} }
@@ -193,6 +201,10 @@ SCENARIO("Multiplying a color by a scalar without modify c", "[features/tuples.f
{ {
REQUIRE(c * 2 == Color(0.4, 0.6, 0.8)); REQUIRE(c * 2 == Color(0.4, 0.6, 0.8));
} }
AND_THEN("c3 = c * 4")
{
REQUIRE(c3 == c * 4);
}
} }
} }
} }

View File

@@ -252,8 +252,6 @@ SCENARIO("Rotating a point around the z axis", "[features/transformations.featur
AND_GIVEN("full_quarter <- rotation_z(pi/2)") AND_GIVEN("full_quarter <- rotation_z(pi/2)")
{ {
Matrix full_quarter = Matrix::rotation_z(std::numbers::pi / 2); Matrix full_quarter = Matrix::rotation_z(std::numbers::pi / 2);
Tuple z = half_quarter * p;
THEN("half_quarter * p = point(-sqrt(2) / 2, sqrt(2) / 2, 0)") THEN("half_quarter * p = point(-sqrt(2) / 2, sqrt(2) / 2, 0)")
{ {
REQUIRE(half_quarter * p == Tuple::Point(-sqrt(2) / 2, sqrt(2) / 2, 0)); REQUIRE(half_quarter * p == Tuple::Point(-sqrt(2) / 2, sqrt(2) / 2, 0));