From 4ef5c934aacbfce6b3c5502425975edcf61cf0e8 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 7 Jan 2022 18:57:08 +0000 Subject: Initial commit GeoData ray tracer --- test/test-geo.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'test/test-geo.cpp') 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>; +BOOST_DATA_TEST_CASE(raytracer, + boost::unit_test::data::make({ + {{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() -- cgit v1.2.3