[FEAT] Add Extra Tests to update code coverage of current code.

This commit is contained in:
NADAL Jean-Baptiste
2024-02-15 17:04:05 +01:00
parent f8c2188f61
commit d67f024711
2 changed files with 75 additions and 0 deletions

View File

@@ -276,6 +276,75 @@ SCENARIO("An intersection encapsulates t and object", "[features/intersections.f
/* ------------------------------------------------------------------------- */
SCENARIO("An intersection could be affected", "[features/intersections.feature]")
{
GIVEN("s <- sphere()")
{
Sphere s;
AND_GIVEN("i1 <- intersection(3.5,s) and i2 <- intersection()")
{
Intersection i1(3.5, s);
Intersection i2;
WHEN("i2 <- i1")
{
i1 = i1;
i2 = i1;
THEN("i2.t = 3.5")
{
REQUIRE(i2.distance_t() == 3.5);
}
AND_THEN("i2.object = s")
{
REQUIRE(i2.object() == s);
}
}
}
}
}
/* ------------------------------------------------------------------------- */
SCENARIO("Intersection could be compared", "[features/intersections.feature]")
{
GIVEN("s <- sphere()")
{
Sphere s;
AND_GIVEN("i1 <- intersection(3,s) and i2 <- intersection(4,s)")
{
Intersection i1(3.0, s);
Intersection i2(4.0, s);
THEN("i2 > i1")
{
REQUIRE(i2 > i1);
}
AND_THEN("i1 < i2")
{
REQUIRE(i1 < i2);
}
AND_THEN("i2 > 2")
{
REQUIRE(i2 > 2.0);
}
AND_THEN("i2 >= 4")
{
REQUIRE(i2 >= 4.0);
}
AND_THEN("i2 < 6")
{
REQUIRE(i2 < 6.0);
}
AND_THEN("i2 <= 4")
{
REQUIRE(i2 <= 4.0);
}
}
}
}
/* ------------------------------------------------------------------------- */
SCENARIO("Aggregating intersections", "[features/intersections.feature]")
{
GIVEN("s <- sphere()")
@@ -420,6 +489,7 @@ SCENARIO("The hit, when all intersections have negative t", "[features/intersect
THEN("i is nothing")
{
REQUIRE(i.is_nothing());
REQUIRE(!i.is_defined());
}
}
}