diff --git a/raytracing/src/canvas.cpp b/raytracing/src/canvas.cpp index 0f1ac26..12a7931 100644 --- a/raytracing/src/canvas.cpp +++ b/raytracing/src/canvas.cpp @@ -107,7 +107,6 @@ std::string Canvas::to_ppm(void) add_color_component(the_result, the_col_number, the_color.blue_to_integer()); } the_result += "\n"; - the_col_number = 0; } return the_result; diff --git a/tests/01_tuples.cpp b/tests/01_tuples.cpp index 1a95824..018dd0c 100644 --- a/tests/01_tuples.cpp +++ b/tests/01_tuples.cpp @@ -271,6 +271,10 @@ SCENARIO("Adding two tuples without modify a1", "[features/tuples.feature]") { 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)); } + 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)); } + 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)); } + AND_THEN("b = a / 2") + { + REQUIRE((a / 2) == b); + } } } } diff --git a/tests/02_1_colors.cpp b/tests/02_1_colors.cpp index abf2ce6..ac8d900 100644 --- a/tests/02_1_colors.cpp +++ b/tests/02_1_colors.cpp @@ -119,6 +119,10 @@ SCENARIO("Adding colors without modify c1", "[features/tuples.feature]") { 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)); } + 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)); } + AND_THEN("c3 = c * 4") + { + REQUIRE(c3 == c * 4); + } } } } diff --git a/tests/04_transformations.cpp b/tests/04_transformations.cpp index 2ae9608..5454b7c 100644 --- a/tests/04_transformations.cpp +++ b/tests/04_transformations.cpp @@ -252,8 +252,6 @@ SCENARIO("Rotating a point around the z axis", "[features/transformations.featur AND_GIVEN("full_quarter <- rotation_z(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)") { REQUIRE(half_quarter * p == Tuple::Point(-sqrt(2) / 2, sqrt(2) / 2, 0));