[FEAT] Add Matrix * Tuple

This commit is contained in:
NADAL Jean-Baptiste
2024-02-01 18:43:27 +01:00
parent 7201bfdf4c
commit 221a1e01e3
6 changed files with 201 additions and 9 deletions

View File

@@ -64,6 +64,46 @@ TEST_CASE("[Tuple] a tuple with w=0 is a vector", "[Tuple]")
/* ------------------------------------------------------------------------- */
TEST_CASE("[Tuple] access of data with []", "[Tuple]")
{
Tuple a(4.3, -4.2, 3.1, 0.0);
REQUIRE(a[0] == 4.3);
REQUIRE(a[1] == -4.2);
REQUIRE(a[2] == 3.1);
REQUIRE(a[3] == 0.0);
}
/* ------------------------------------------------------------------------- */
TEST_CASE("[Tuple] constructor with std::vector", "[Tuple]")
{
std::vector<double> v = {4.3, -4.2, 3.1, 0.0};
Tuple a(v);
REQUIRE(a[0] == 4.3);
REQUIRE(a[1] == -4.2);
REQUIRE(a[2] == 3.1);
REQUIRE(a[3] == 0.0);
}
/* ------------------------------------------------------------------------- */
TEST_CASE("[Tuple] test copy constructor", "[Tuple]")
{
Tuple a;
Tuple b(4.3, -4.2, 3.1, 0.0);
a = b;
REQUIRE(a[0] == 4.3);
REQUIRE(a[1] == -4.2);
REQUIRE(a[2] == 3.1);
REQUIRE(a[3] == 0.0);
}
/* ------------------------------------------------------------------------- */
TEST_CASE("[Tuple] Tuple could be copy", "[Tuple]")
{
Tuple p = Tuple::Point(4, -4, 3);