Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (39 sloc) 905 Bytes
/*
* test_Scene.cpp
*
* Created on: 17-Feb-2015
* Author: argha
*/
#include "Scene.hpp"
#include "Sphere.hpp"
#include <gtest/gtest.h>
#include "TestVector.cpp"
#include "TestColors.cpp"
#include "TestRays.cpp"
#include <iostream>
using namespace raytracer;
using namespace testing;
TEST(TestScene, testcreation)
{
Point center(2, 0, 0);
Scalar radius = 1;
Sphere s1(center, radius);
EXPECT_TRUE(center == s1.getCenter());
EXPECT_TRUE(radius == s1.getRadius());
}
TEST(TestScene, testintersection)
{
Point center(2, 0, 0);
Scalar radius = 1;
Sphere s1(center, radius);
Point origin(0,0,0);
Vector direction(2,0,0);
Ray r(origin,direction);
float intersection = s1.intersection(r);
EXPECT_TRUE(r.get_point_at_t(intersection)==Point(1,0,0));
}
int main(int argc, char** argv)
{
InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}