diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-01-08 16:34:43 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-01-08 16:34:43 +0000 |
commit | 8cd0977a3688fa705c83867c57505a47b9269369 (patch) | |
tree | b7b48711051299607077ed31fdf3b3f6dd6cc41f /test/test-geo.cpp | |
parent | Tidy shadow map creation (diff) | |
download | ilt-8cd0977a3688fa705c83867c57505a47b9269369.tar.bz2 ilt-8cd0977a3688fa705c83867c57505a47b9269369.tar.xz ilt-8cd0977a3688fa705c83867c57505a47b9269369.zip |
Fix up all the static analyzer warnings
Diffstat (limited to 'test/test-geo.cpp')
-rw-r--r-- | test/test-geo.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/test-geo.cpp b/test/test-geo.cpp index 7f072bc..bc442e9 100644 --- a/test/test-geo.cpp +++ b/test/test-geo.cpp @@ -1,6 +1,6 @@ #define BOOST_TEST_MODULE test_geo -#include "test-helpers.hpp" +#include "testHelpers.h" #include <boost/test/data/test_case.hpp> #include <boost/test/unit_test.hpp> #include <stream_support.hpp> @@ -169,8 +169,9 @@ BOOST_DATA_TEST_CASE(intersect_ray, nodes[at(1, 1)].height = 4; const auto intersect = intersectRay({start, glm::normalize(dir)}); - BOOST_REQUIRE(intersect); - BOOST_CHECK_CLOSE_VEC(*intersect, pos); + BOOST_CHECK_IF(has_intersect, intersect) { + BOOST_CHECK_CLOSE_VEC(*intersect, pos); + } } auto xs = boost::unit_test::data::xrange(-20.F, 0.F, 0.6F), ys = boost::unit_test::data::xrange(-20.F, 0.F, 0.7F); @@ -185,13 +186,14 @@ BOOST_DATA_TEST_CASE(intersect_ray_many, xs * ys * targetsx * targetsy, x, y, ta nodes[at(0, 1)].height = 3; nodes[at(1, 1)].height = 4; - glm::vec3 start {x, y, 10}; + const glm::vec3 start {x, y, 10}; const auto target {this->positionAt({targetx, targety})}; - Ray ray {start, glm::normalize(target - start)}; + const Ray ray {start, glm::normalize(target - start)}; BOOST_TEST_CONTEXT(ray) { const auto intersect = intersectRay(ray); - BOOST_REQUIRE(intersect); - BOOST_CHECK_CLOSE_VEC(*intersect, target); + BOOST_CHECK_IF(has_intersect, intersect) { + BOOST_CHECK_CLOSE_VEC(*intersect, target); + } } } |