summaryrefslogtreecommitdiff
path: root/test/test-geo.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-01-07 18:57:08 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-01-07 19:02:01 +0000
commit4ef5c934aacbfce6b3c5502425975edcf61cf0e8 (patch)
tree4f7a64f173dc9bab8467f32b95eb111cf5f0f162 /test/test-geo.cpp
parentDon't invoke CHECK parameters multiple times (diff)
downloadilt-4ef5c934aacbfce6b3c5502425975edcf61cf0e8.tar.bz2
ilt-4ef5c934aacbfce6b3c5502425975edcf61cf0e8.tar.xz
ilt-4ef5c934aacbfce6b3c5502425975edcf61cf0e8.zip
Initial commit GeoData ray tracer
Diffstat (limited to 'test/test-geo.cpp')
-rw-r--r--test/test-geo.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/test-geo.cpp b/test/test-geo.cpp
index 63f192b..f0ed693 100644
--- a/test/test-geo.cpp
+++ b/test/test-geo.cpp
@@ -97,4 +97,44 @@ 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>>;
+BOOST_DATA_TEST_CASE(raytracer,
+ boost::unit_test::data::make<TestRayTracerData>({
+ {{0, 0}, {0, 0}, 3,
+ {
+ {0, 0},
+ }},
+ {{0, 0}, {4, 5}, 4,
+ {
+ {0, 0},
+ {0, 4},
+ {4, 4},
+ {4, 8},
+ {8, 8},
+ {8, 12},
+ {12, 12},
+ {12, 16},
+ {16, 16},
+ {16, 20},
+ }},
+ {{-1, -1}, {-4, -5}, 5,
+ {
+ {-1, -1},
+ {-6, -1},
+ {-6, -6},
+ {-6, -11},
+ {-11, -11},
+ {-11, -16},
+ {-16, -16},
+ {-16, -21},
+ }},
+ }),
+ start, end, scale, points)
+{
+ GeoData::RayTracer rt {start, end, scale};
+ for (const auto & point : points) {
+ BOOST_CHECK_CLOSE_VEC(point, rt.next());
+ }
+}
+
BOOST_AUTO_TEST_SUITE_END()