[FEAT] Add Extra Tests to update code coverage of current code.
This commit is contained in:
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -92,5 +92,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"gcovViewer.buildDirectories": [
|
||||
"/home/jbnadal/sources/jb/raytracing_challenge/build/raytracing/CMakeFiles/raytracing.dir/src",
|
||||
"/home/jbnadal/sources/jb/raytracing_challenge/build/apps/CMakeFiles/chapter_05.dir",
|
||||
"/home/jbnadal/sources/jb/raytracing_challenge/build/tests/CMakeFiles/raytracing_test.dir"
|
||||
]
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user