This commit is contained in:
2026-08-06 15:17:59 +07:00
parent 701d25f952
commit 5375a9da9e
33 changed files with 3199 additions and 137 deletions

View File

@@ -77,6 +77,7 @@ public:
{
robot::NodeHandle nh;
std::string error;
runner_.disableCostmapLockForTesting(); // costmap placeholder
ok_ = runner_.configure(nh, dummyCostmap(), name, error);
error_ = error;
}
@@ -110,6 +111,7 @@ TEST(PlannerRunner, RefusesNullCostmap)
// định "sập hay không" cho từng plugin tự lo.
robot::NodeHandle nh;
PlannerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
std::string error;
EXPECT_FALSE(runner.configure(nh, nullptr, "TestPlannerOk", error));
@@ -121,6 +123,7 @@ TEST(PlannerRunner, ConfiguresWithoutAnInitialPlanner)
{
robot::NodeHandle nh;
PlannerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
std::string error;
ASSERT_TRUE(runner.configure(nh, dummyCostmap(), "", error)) << error;
@@ -143,6 +146,7 @@ TEST(PlannerRunner, ConfigureFailsWhenTheInitialPlannerCannotBeLoaded)
{
robot::NodeHandle nh;
PlannerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
std::string error;
EXPECT_FALSE(runner.configure(nh, dummyCostmap(), "TestPlannerMissingLibrary", error));
@@ -200,6 +204,7 @@ TEST(PlannerRunner, PlannerReportingInitializeFailureIsRejected)
// Bản cũ chỉ log rồi đi tiếp với planner chưa khởi tạo xong.
robot::NodeHandle nh;
PlannerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
std::string error;
EXPECT_FALSE(runner.configure(nh, dummyCostmap(), "TestPlannerInitFails", error));
@@ -227,6 +232,7 @@ TEST(PlannerRunner, RefusesEmptyPlannerName)
TEST(PlannerRunner, SwapBeforeConfigureIsRefused)
{
PlannerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
EXPECT_FALSE(runner.swapPlanner("TestPlannerOk"));
}
@@ -326,6 +332,7 @@ TEST(PlannerRunner, StartPlanWithoutAnActivePlannerFails)
{
robot::NodeHandle nh;
PlannerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
std::string error;
ASSERT_TRUE(runner.configure(nh, dummyCostmap(), "", error)) << error;
@@ -408,6 +415,7 @@ TEST(PlannerRunner, DestructorJoinsWhileAPlanIsInFlight)
std::string error;
{
PlannerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
ASSERT_TRUE(runner.configure(nh, dummyCostmap(), "TestPlannerOk", error)) << error;
EXPECT_TRUE(runner.startPlan(makePose(0.0, 0.0), makePose(2.0, 0.0), nullptr, 1));
}