summaryrefslogtreecommitdiff
path: root/test/test-terrain.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-10-31 19:36:16 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-10-31 19:36:16 +0000
commitb46cf55d66f262778bf0353650f00620c7740f2a (patch)
treefa05eb4f71f31f33fdb86441d9877fad352d2d52 /test/test-terrain.cpp
parentUpdate walk/walkUntil to work on PointFace from parameter (diff)
downloadilt-b46cf55d66f262778bf0353650f00620c7740f2a.tar.bz2
ilt-b46cf55d66f262778bf0353650f00620c7740f2a.tar.xz
ilt-b46cf55d66f262778bf0353650f00620c7740f2a.zip
Make PointFace harder to misuse
Diffstat (limited to 'test/test-terrain.cpp')
-rw-r--r--test/test-terrain.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/test-terrain.cpp b/test/test-terrain.cpp
index bf30179..bf73356 100644
--- a/test/test-terrain.cpp
+++ b/test/test-terrain.cpp
@@ -49,10 +49,16 @@ BOOST_AUTO_TEST_CASE(trianglesContainsPoints)
BOOST_AUTO_TEST_CASE(locatePointFace)
{
const PointFace pf {{310002, 490003}};
- BOOST_CHECK(!pf.face.is_valid());
- BOOST_CHECK(locate(pf));
- BOOST_CHECK(pf.face.is_valid());
- BOOST_CHECK_EQUAL(pf.face.idx(), 0);
+ BOOST_CHECK(!pf.isLocated());
+ BOOST_CHECK(pf.face(this).is_valid());
+ BOOST_CHECK_EQUAL(pf.face(this).idx(), 0);
+}
+
+BOOST_AUTO_TEST_CASE(preLocatePointFace)
+{
+ const PointFace pf {{310002, 490003}, this};
+ BOOST_CHECK(pf.isLocated());
+ BOOST_CHECK_EQUAL(pf.face(this).idx(), 0);
}
BOOST_AUTO_TEST_SUITE_END();
@@ -107,7 +113,7 @@ BOOST_DATA_TEST_CASE(walkTerrainSetsFromFace,
{
TerrainMesh::PointFace pf {from};
BOOST_CHECK_NO_THROW(fixedTerrtain.walk(pf, to, [](auto) {}));
- BOOST_CHECK_EQUAL(pf.face.idx(), visits.front());
+ BOOST_CHECK_EQUAL(pf.face(&fixedTerrtain).idx(), visits.front());
}
BOOST_DATA_TEST_CASE(walkTerrainUntil,