From 257640da13b809b07dd480104749c27427dd7e82 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Wed, 5 Feb 2025 00:12:26 -0800 Subject: [PATCH] Do not use memnew instead of instantiate. --- .../goal_task_planner/tests/test_logistics.h | 48 ++++++++++++------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/modules/goal_task_planner/tests/test_logistics.h b/modules/goal_task_planner/tests/test_logistics.h index 534ad69c46af..833d9398f6b6 100644 --- a/modules/goal_task_planner/tests/test_logistics.h +++ b/modules/goal_task_planner/tests/test_logistics.h @@ -416,8 +416,10 @@ void before_each(Dictionary &p_state, Ref p_planner, Ref p_the_dom } TEST_CASE("[Modules][GoalTaskPlanner] m_drive_truck") { - Ref planner = Ref(memnew(Plan)); - Ref the_domain = Ref(memnew(Domain)); + Ref planner; + planner.instantiate(); + Ref the_domain; + the_domain.instantiate(); Dictionary state1; before_each(state1, planner, the_domain); Array task; @@ -429,7 +431,8 @@ TEST_CASE("[Modules][GoalTaskPlanner] m_drive_truck") { } TEST_CASE("[Modules][GoalTaskPlanner] Fly plane") { - Ref planner = Ref(memnew(Plan)); + Ref planner; + planner.instantiate(); Ref the_domain = Ref(memnew(Domain)); Dictionary state1; before_each(state1, planner, the_domain); @@ -442,8 +445,10 @@ TEST_CASE("[Modules][GoalTaskPlanner] Fly plane") { } TEST_CASE("[Modules][GoalTaskPlanner] Load truck") { - Ref planner = Ref(memnew(Plan)); - Ref the_domain = Ref(memnew(Domain)); + Ref planner; + planner.instantiate(); + Ref the_domain; + the_domain.instantiate(); Dictionary state1; before_each(state1, planner, the_domain); Array task; @@ -454,8 +459,10 @@ TEST_CASE("[Modules][GoalTaskPlanner] Load truck") { } TEST_CASE("[Modules][GoalTaskPlanner] Move Goal 1") { - Ref planner = Ref(memnew(Plan)); - Ref the_domain = Ref(memnew(Domain)); + Ref planner; + planner.instantiate(); + Ref the_domain; + the_domain.instantiate(); Dictionary state1; before_each(state1, planner, the_domain); Array task; @@ -477,8 +484,10 @@ TEST_CASE("[Modules][GoalTaskPlanner] Move Goal 1") { } TEST_CASE("[Modules][GoalTaskPlanner] Move Goal 2") { - Ref planner = Ref(memnew(Plan)); - Ref the_domain = Ref(memnew(Domain)); + Ref planner; + planner.instantiate(); + Ref the_domain; + the_domain.instantiate(); Dictionary state1; before_each(state1, planner, the_domain); @@ -504,8 +513,10 @@ TEST_CASE("[Modules][GoalTaskPlanner] Move Goal 2") { } TEST_CASE("[Modules][GoalTaskPlanner] Move Goal 3") { - Ref planner = Ref(memnew(Plan)); - Ref the_domain = Ref(memnew(Domain)); + Ref planner; + planner.instantiate(); + Ref the_domain; + the_domain.instantiate(); Dictionary state1; before_each(state1, planner, the_domain); @@ -518,8 +529,10 @@ TEST_CASE("[Modules][GoalTaskPlanner] Move Goal 3") { } TEST_CASE("[Modules][GoalTaskPlanner] Move Goal 4") { - Ref planner = Ref(memnew(Plan)); - Ref the_domain = Ref(memnew(Domain)); + Ref planner; + planner.instantiate(); + Ref the_domain; + the_domain.instantiate(); Dictionary state1; before_each(state1, planner, the_domain); Array task; @@ -534,8 +547,10 @@ TEST_CASE("[Modules][GoalTaskPlanner] Move Goal 4") { } TEST_CASE("[Modules][GoalTaskPlanner] run_lazy_lookahead") { - Ref planner = Ref(memnew(Plan)); - Ref the_domain = Ref(memnew(Domain)); + Ref planner; + planner.instantiate(); + Ref the_domain; + the_domain.instantiate(); Dictionary state; before_each(state, planner, the_domain); Array task; @@ -590,7 +605,8 @@ TEST_CASE("[Modules][GoalTaskPlanner] Multigoal") { truck_at["truck1"] = "location1"; goal_state["truck_at"] = truck_at; goal_state["at"] = at; - Ref multi_goal = Ref(memnew(Multigoal("Multigoal", goal_state))); + Ref multi_goal; + multi_goal.instantiate("Multigoal", goal_state); Array task; task.push_back(multi_goal); Array plan = planner->find_plan(state, task);