summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-01-08 13:39:36 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-01-08 19:30:12 +0000
commitc508f08ce4841eabbcaf5df7c31ff4331aa9750c (patch)
treeecf1bd2212309fd79f92f11547dcbebda2eef3e6 /test
parentHave CLOG write to cerr, clog doesn't sync with Boost test output (diff)
downloadilt-c508f08ce4841eabbcaf5df7c31ff4331aa9750c.tar.bz2
ilt-c508f08ce4841eabbcaf5df7c31ff4331aa9750c.tar.xz
ilt-c508f08ce4841eabbcaf5df7c31ff4331aa9750c.zip
Tweak ray tracer calls to account for scale
Diffstat (limited to 'test')
-rw-r--r--test/test-geo.cpp33
1 files changed, 15 insertions, 18 deletions
diff --git a/test/test-geo.cpp b/test/test-geo.cpp
index f0ed693..07e3bd1 100644
--- a/test/test-geo.cpp
+++ b/test/test-geo.cpp
@@ -97,14 +97,11 @@ BOOST_AUTO_TEST_CASE(get_height_at)
BOOST_CHECK_EQUAL(positionAt({2.5F, 2.5F}), glm::vec3(2.5F, 2.5F, 2.5F));
}
-using TestRayTracerData = std::tuple<glm::vec2, glm::vec2, float, std::vector<glm::vec2>>;
+using TestRayTracerData = std::tuple<glm::vec2, glm::vec2, glm::vec2::value_type, std::vector<glm::vec2>>;
+BOOST_TEST_DECORATOR(*boost::unit_test::timeout(1))
BOOST_DATA_TEST_CASE(raytracer,
boost::unit_test::data::make<TestRayTracerData>({
- {{0, 0}, {0, 0}, 3,
- {
- {0, 0},
- }},
- {{0, 0}, {4, 5}, 4,
+ {{1, 2}, {4, 5}, 4,
{
{0, 0},
{0, 4},
@@ -114,26 +111,26 @@ BOOST_DATA_TEST_CASE(raytracer,
{8, 12},
{12, 12},
{12, 16},
- {16, 16},
+ {12, 20},
{16, 20},
}},
{{-1, -1}, {-4, -5}, 5,
{
- {-1, -1},
- {-6, -1},
- {-6, -6},
- {-6, -11},
- {-11, -11},
- {-11, -16},
- {-16, -16},
- {-16, -21},
+ {-5, -5},
+ {-5, -10},
+ {-10, -10},
+ {-10, -15},
+ {-15, -15},
+ {-15, -20},
+ {-20, -20},
+ {-20, -25},
}},
}),
- start, end, scale, points)
+ start, dir, scale, points)
{
- GeoData::RayTracer rt {start, end, scale};
+ GeoData::RayTracer rt {start / scale, glm::normalize(dir)};
for (const auto & point : points) {
- BOOST_CHECK_CLOSE_VEC(point, rt.next());
+ BOOST_CHECK_CLOSE_VEC(point, rt.next() * scale);
}
}