[FEAT] Tuple add negative

This commit is contained in:
2024-01-29 23:56:45 +01:00
parent 3595f21d70
commit 3573d634ac
3 changed files with 37 additions and 4 deletions

View File

@@ -120,3 +120,22 @@ TEST_CASE("Subtracting two vectors", "[Tuple][Operations]")
REQUIRE((v1 - v2) == Tuple::Vector(-2, -4, -6));
}
/* ------------------------------------------------------------------------- */
TEST_CASE("Subtracting a vector from the zero vector", "[Tuple][Operations]")
{
Tuple zero = Tuple::Vector(0, 0, 0);
Tuple v = Tuple::Vector(1, -2, 3);
REQUIRE((zero - v) == Tuple::Vector(-1, 2, -3));
}
/* ------------------------------------------------------------------------- */
TEST_CASE("Negative a tuple", "[Tuple][Operations]")
{
Tuple a(1, -2, 3, -4);
REQUIRE(-a == Tuple(-1, 2, -3, 4));
}