diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-10-29 14:11:46 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-10-29 15:26:09 +0000 |
commit | 49a422ed91289a31142a8c0fb8b7030d2dea98a1 (patch) | |
tree | 9bdc69a8f6ee4cc6eda388eea6e0baa5606ff4b5 /test/test-terrain.cpp | |
parent | Initial OpenMesh based terrain data and tests (diff) | |
download | ilt-49a422ed91289a31142a8c0fb8b7030d2dea98a1.tar.bz2 ilt-49a422ed91289a31142a8c0fb8b7030d2dea98a1.tar.xz ilt-49a422ed91289a31142a8c0fb8b7030d2dea98a1.zip |
Initial commit of findPoint on terrain
2D navigate from a default/given starting point, possible scope for improvement, but it's
not exactly slow; <9ms
Diffstat (limited to 'test/test-terrain.cpp')
-rw-r--r-- | test/test-terrain.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test-terrain.cpp b/test/test-terrain.cpp index b2358d6..d062853 100644 --- a/test/test-terrain.cpp +++ b/test/test-terrain.cpp @@ -1,4 +1,5 @@ #define BOOST_TEST_MODULE terrain +#include <boost/test/data/test_case.hpp> #include <boost/test/unit_test.hpp> #include <stream_support.h> @@ -46,3 +47,21 @@ BOOST_AUTO_TEST_CASE(trianglesContainsPoints) } BOOST_AUTO_TEST_SUITE_END(); + +using FindPointData = std::tuple<glm::vec2, int>; + +static const TestTerrainMesh fixedTerrtain; + +// No boundary cases as these can produce different valid results depending on starting point +BOOST_DATA_TEST_CASE(findPointOnTerrain, + boost::unit_test::data::make<FindPointData>({ + {{0, 0}, -1}, {{xllcorner, 0}, -1}, {{0, yllcorner}, -1}, {{xllcorner + 1, yllcorner + 2}, 0}, + {{xllcorner + (cellsize * (nrows - 1)) - 2, yllcorner + (cellsize * (ncols - 1)) - 1}, 79200}, + {{315555, 495556}, 44400}, // perf test target + }) + * boost::unit_test::data::make<int>( + {0, 1, 2, 3, 4, 5, 6, 10, 100, 150, 200, 1000, 1234, 17439, 79201, 79200, 79199}), + p, fh, start) +{ + BOOST_CHECK_EQUAL(fh, fixedTerrtain.findPoint(p, TerrainMesh::FaceHandle(start)).idx()); +} |