Skip to content

Commit be98f1b

Browse files
go-sakayoripre-commit-ci[bot]
authored andcommitted
test: behavior path obstacle avoidance (autowarefoundation#6972)
* write test for behavior avoidance Signed-off-by: Go Sakayori <gsakayori@gmail.com> * style(pre-commit): autofix --------- Signed-off-by: Go Sakayori <gsakayori@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: vividf <yihsiang.fang@tier4.jp>
1 parent a4aad3c commit be98f1b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

planning/behavior_path_avoidance_module/test/test_utils.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using behavior_path_planner::ObjectData;
2222
using behavior_path_planner::utils::avoidance::isOnRight;
2323
using behavior_path_planner::utils::avoidance::isSameDirectionShift;
24+
using behavior_path_planner::utils::avoidance::isShiftNecessary;
2425

2526
TEST(BehaviorPathPlanningAvoidanceUtilsTest, shiftLengthDirectionTest)
2627
{
@@ -37,3 +38,19 @@ TEST(BehaviorPathPlanningAvoidanceUtilsTest, shiftLengthDirectionTest)
3738
ASSERT_TRUE(isSameDirectionShift(isOnRight(left_obj), positive_shift_length));
3839
ASSERT_FALSE(isSameDirectionShift(isOnRight(left_obj), negative_shift_length));
3940
}
41+
42+
TEST(BehaviorPathPlanningAvoidanceUtilsTest, shiftNecessaryTest)
43+
{
44+
ObjectData right_obj;
45+
right_obj.direction = route_handler::Direction::RIGHT;
46+
const double negative_shift_length = -1.0;
47+
const double positive_shift_length = 1.0;
48+
49+
ASSERT_TRUE(isShiftNecessary(isOnRight(right_obj), positive_shift_length));
50+
ASSERT_FALSE(isShiftNecessary(isOnRight(right_obj), negative_shift_length));
51+
52+
ObjectData left_obj;
53+
left_obj.direction = route_handler::Direction::LEFT;
54+
ASSERT_TRUE(isShiftNecessary(isOnRight(left_obj), negative_shift_length));
55+
ASSERT_FALSE(isShiftNecessary(isOnRight(left_obj), positive_shift_length));
56+
}

0 commit comments

Comments
 (0)