diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-04 13:12:24 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-04 13:12:24 +0000 |
commit | d46d8385ab68fd8f902016b3e7406290cb46c0db (patch) | |
tree | 444eb326391f77e405a832236345548f85402f1c /test/test-geo.cpp | |
parent | Calculate and expose the extents of the terrain mesh (diff) | |
download | ilt-d46d8385ab68fd8f902016b3e7406290cb46c0db.tar.bz2 ilt-d46d8385ab68fd8f902016b3e7406290cb46c0db.tar.xz ilt-d46d8385ab68fd8f902016b3e7406290cb46c0db.zip |
Reformat test source
Diffstat (limited to 'test/test-geo.cpp')
-rw-r--r-- | test/test-geo.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test-geo.cpp b/test/test-geo.cpp index e672e54..9874fb7 100644 --- a/test/test-geo.cpp +++ b/test/test-geo.cpp @@ -108,6 +108,7 @@ BOOST_AUTO_TEST_CASE(get_height_at) 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>({ {{1, 2}, {4, 5}, 4, @@ -145,6 +146,7 @@ BOOST_DATA_TEST_CASE(raytracer, using TestRayData = std::tuple<glm::vec3, glm::vec3, glm::vec3>; BOOST_TEST_DECORATOR(*boost::unit_test::timeout(1)) + BOOST_DATA_TEST_CASE(intersect_ray, boost::unit_test::data::make<TestRayData>({ {{-1, -1, 1.0}, {1, 1, 0}, {0, 0, 1}}, @@ -169,6 +171,7 @@ BOOST_DATA_TEST_CASE(intersect_ray, nodes[at(1, 1)].height = 4; const auto intersect = intersectRay({start, glm::normalize(dir)}); + BOOST_CHECK_IF(has_intersect, intersect) { BOOST_CHECK_CLOSE_VEC(*intersect, pos); } @@ -178,6 +181,7 @@ auto xs = boost::unit_test::data::xrange(-20.F, 0.F, 0.6F), ys = boost::unit_tes auto targetsx = boost::unit_test::data::xrange(0.2F, 4.9F, 1.3F), targetsy = boost::unit_test::data::xrange(0.3F, 4.9F, 1.3F); BOOST_TEST_DECORATOR(*boost::unit_test::timeout(1)) + BOOST_DATA_TEST_CASE(intersect_ray_many, xs * ys * targetsx * targetsy, x, y, targetx, targety) { // at(x,y) is index based @@ -189,8 +193,10 @@ BOOST_DATA_TEST_CASE(intersect_ray_many, xs * ys * targetsx * targetsy, x, y, ta const glm::vec3 start {x, y, 10}; const auto target {this->positionAt({targetx, targety})}; const Ray ray {start, glm::normalize(target - start)}; + BOOST_TEST_CONTEXT(ray) { const auto intersect = intersectRay(ray); + BOOST_CHECK_IF(has_intersect, intersect) { BOOST_CHECK_CLOSE_VEC(*intersect, target); } @@ -198,6 +204,7 @@ BOOST_DATA_TEST_CASE(intersect_ray_many, xs * ys * targetsx * targetsy, x, y, ta } BOOST_TEST_DECORATOR(*boost::unit_test::timeout(1)) + BOOST_DATA_TEST_CASE(intersect_ray_miss, boost::unit_test::data::make<Ray>({ {{3, 3, 5}, {-1, -1, 0}}, |