[FEAT] Update code coverage
This commit is contained in:
@@ -38,12 +38,6 @@ using namespace Raytracer;
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
Canvas::Canvas(void) : m_width(0), m_height(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
Canvas::Canvas(uint16_t a_width, uint16_t a_height) : m_width(a_width), m_height(a_height)
|
Canvas::Canvas(uint16_t a_width, uint16_t a_height) : m_width(a_width), m_height(a_height)
|
||||||
{
|
{
|
||||||
m_pixels = std::vector<std::vector<Color>>(m_width, std::vector<Color>(m_height));
|
m_pixels = std::vector<std::vector<Color>>(m_width, std::vector<Color>(m_height));
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ namespace Raytracer
|
|||||||
class Canvas
|
class Canvas
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Canvas(void);
|
|
||||||
Canvas(uint16_t a_width, uint16_t a_height);
|
Canvas(uint16_t a_width, uint16_t a_height);
|
||||||
|
|
||||||
uint16_t width(void) const;
|
uint16_t width(void) const;
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ Intersections::Intersections(const std::initializer_list<Intersection> &a_list)
|
|||||||
|
|
||||||
Intersections::Intersections(Intersections &an_other)
|
Intersections::Intersections(Intersections &an_other)
|
||||||
{
|
{
|
||||||
std::copy(an_other.m_data.begin(), an_other.m_data.end(), m_data.begin());
|
m_data.reserve(an_other.m_data.size());
|
||||||
|
m_data.assign(an_other.m_data.begin(), an_other.m_data.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
@@ -64,7 +65,8 @@ const Intersections &Intersections::operator=(const Intersections &an_other)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::copy(an_other.m_data.begin(), an_other.m_data.end(), m_data.begin());
|
m_data.reserve(an_other.m_data.size());
|
||||||
|
m_data.assign(an_other.m_data.begin(), an_other.m_data.end());
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -379,6 +379,39 @@ SCENARIO("Aggregating intersections", "[features/intersections.feature]")
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
SCENARIO("Operations with intersections", "[features/intersections.feature]")
|
||||||
|
{
|
||||||
|
GIVEN("xs <- intersections({})")
|
||||||
|
{
|
||||||
|
Intersections xs1({});
|
||||||
|
AND_GIVEN("s <- sphere()")
|
||||||
|
{
|
||||||
|
Sphere s;
|
||||||
|
Intersection i1(1, s);
|
||||||
|
AND_GIVEN("xs2 <- intersections({i1})")
|
||||||
|
{
|
||||||
|
Intersections xs2({i1});
|
||||||
|
WHEN("xs1 <- xs2")
|
||||||
|
{
|
||||||
|
// xs2 = xs2;
|
||||||
|
xs1 = xs2;
|
||||||
|
THEN("xs1.count = 1")
|
||||||
|
{
|
||||||
|
REQUIRE(xs1.count() == 1);
|
||||||
|
}
|
||||||
|
Intersections xs3 = xs1;
|
||||||
|
THEN("xs3.count = 1")
|
||||||
|
{
|
||||||
|
REQUIRE(xs3.count() == 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
SCENARIO("Intersect sets the object on the intersection", "[features/spheres.feature]")
|
SCENARIO("Intersect sets the object on the intersection", "[features/spheres.feature]")
|
||||||
{
|
{
|
||||||
GIVEN("r <- ray(point(0, 0, 5), vector(0, 0, 1))")
|
GIVEN("r <- ray(point(0, 0, 5), vector(0, 0, 1))")
|
||||||
|
|||||||
Reference in New Issue
Block a user