From b46cf55d66f262778bf0353650f00620c7740f2a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 31 Oct 2023 19:36:16 +0000 Subject: Make PointFace harder to misuse --- test/test-terrain.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'test') 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, -- cgit v1.2.3