Skip to content

Commit

Permalink
Add test for NavigationServer path simplification
Browse files Browse the repository at this point in the history
Adds test for NavigationServer3D.simplify_path() function.
  • Loading branch information
smix8 committed Nov 26, 2024
1 parent bbc5469 commit b2e4082
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/servers/test_navigation_server_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,21 @@ TEST_SUITE("[Navigation]") {
}
*/

TEST_CASE("[NavigationServer3D] Server should simplify path properly") {
real_t simplify_epsilon = 0.2;
Vector<Vector3> source_path;
source_path.resize(7);
source_path.write[0] = Vector3(0.0, 0.0, 0.0);
source_path.write[1] = Vector3(0.0, 0.0, 1.0); // This point needs to go.
source_path.write[2] = Vector3(0.0, 0.0, 2.0); // This point needs to go.
source_path.write[3] = Vector3(0.0, 0.0, 2.0);
source_path.write[4] = Vector3(2.0, 1.0, 3.0);
source_path.write[5] = Vector3(2.0, 1.5, 4.0); // This point needs to go.
source_path.write[6] = Vector3(2.0, 2.0, 5.0);
Vector<Vector3> simplified_path = NavigationServer3D::get_singleton()->simplify_path(source_path, simplify_epsilon);
CHECK_EQ(simplified_path.size(), 4);
}

TEST_CASE("[Heap] size") {
gd::Heap<int> heap;

Expand Down

0 comments on commit b2e4082

Please sign in to comment.