Skip to content

Commit

Permalink
test: behavior path obstacle avoidance (#6972)
Browse files Browse the repository at this point in the history
* write test for behavior avoidance

Signed-off-by: Go Sakayori <[email protected]>

* style(pre-commit): autofix

---------

Signed-off-by: Go Sakayori <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
go-sakayori and pre-commit-ci[bot] authored May 13, 2024
1 parent bffbcce commit fd89ca2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions planning/behavior_path_avoidance_module/test/test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using behavior_path_planner::ObjectData;
using behavior_path_planner::utils::avoidance::isOnRight;
using behavior_path_planner::utils::avoidance::isSameDirectionShift;
using behavior_path_planner::utils::avoidance::isShiftNecessary;

TEST(BehaviorPathPlanningAvoidanceUtilsTest, shiftLengthDirectionTest)
{
Expand All @@ -37,3 +38,19 @@ TEST(BehaviorPathPlanningAvoidanceUtilsTest, shiftLengthDirectionTest)
ASSERT_TRUE(isSameDirectionShift(isOnRight(left_obj), positive_shift_length));
ASSERT_FALSE(isSameDirectionShift(isOnRight(left_obj), negative_shift_length));
}

TEST(BehaviorPathPlanningAvoidanceUtilsTest, shiftNecessaryTest)
{
ObjectData right_obj;
right_obj.direction = route_handler::Direction::RIGHT;
const double negative_shift_length = -1.0;
const double positive_shift_length = 1.0;

ASSERT_TRUE(isShiftNecessary(isOnRight(right_obj), positive_shift_length));
ASSERT_FALSE(isShiftNecessary(isOnRight(right_obj), negative_shift_length));

ObjectData left_obj;
left_obj.direction = route_handler::Direction::LEFT;
ASSERT_TRUE(isShiftNecessary(isOnRight(left_obj), negative_shift_length));
ASSERT_FALSE(isShiftNecessary(isOnRight(left_obj), positive_shift_length));
}

0 comments on commit fd89ca2

Please sign in to comment.