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

@@ -96,6 +96,7 @@ public:
{
robot::NodeHandle nh;
std::string error;
runner_.disableCostmapLockForTesting(); // costmap placeholder
ok_ = runner_.configure(nh, nullptr, dummyCostmap(), &fixedPose(), name, error);
error_ = error;
}
@@ -127,6 +128,7 @@ TEST(ControllerRunner, RefusesNullCostmap)
{
robot::NodeHandle nh;
ControllerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
std::string error;
EXPECT_FALSE(runner.configure(nh, nullptr, nullptr, &fixedPose(), "TestControllerOk", error));
@@ -140,6 +142,7 @@ TEST(ControllerRunner, RefusesNullPosePort)
// thì không gọi được hàm nào trong hai hàm đó.
robot::NodeHandle nh;
ControllerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
std::string error;
EXPECT_FALSE(runner.configure(nh, nullptr, dummyCostmap(), nullptr, "TestControllerOk", error));
@@ -150,6 +153,7 @@ TEST(ControllerRunner, ConfigureFailsWhenTheInitialControllerCannotBeLoaded)
{
robot::NodeHandle nh;
ControllerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
std::string error;
EXPECT_FALSE(runner.configure(nh, nullptr, dummyCostmap(), &fixedPose(), "TestControllerMissing", error));
@@ -194,6 +198,7 @@ TEST(ControllerRunner, FailedSwapKeepsThePreviousControllerActive)
TEST(ControllerRunner, SwapBeforeConfigureIsRefused)
{
ControllerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
EXPECT_FALSE(runner.swapPlanner("TestControllerOk"));
}
@@ -238,6 +243,7 @@ TEST(ControllerRunner, LimitSetBeforeAControllerExistsIsAppliedOnceItIsLoaded)
// Thứ tự khởi tạo không do move_base2 quyết: host có thể đặt trần trước khi controller được nạp.
robot::NodeHandle nh;
ControllerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
std::string error;
ASSERT_TRUE(runner.configure(nh, nullptr, dummyCostmap(), &fixedPose(), "", error)) << error;
@@ -360,6 +366,7 @@ TEST(ControllerRunner, SetPlanWithoutAControllerFails)
{
robot::NodeHandle nh;
ControllerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
std::string error;
ASSERT_TRUE(runner.configure(nh, nullptr, dummyCostmap(), &fixedPose(), "", error)) << error;
@@ -370,6 +377,7 @@ TEST(ControllerRunner, ComputeWithoutAControllerYieldsNoCommand)
{
robot::NodeHandle nh;
ControllerRunner runner;
runner.disableCostmapLockForTesting(); // costmap của test là placeholder, không dereference được
std::string error;
ASSERT_TRUE(runner.configure(nh, nullptr, dummyCostmap(), &fixedPose(), "", error)) << error;