Skip to content

Commit

Permalink
fix build warning
Browse files Browse the repository at this point in the history
Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com>
  • Loading branch information
TakaHoribe committed Apr 3, 2022
1 parent 05eb9f0 commit ac73fdc
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions planning/behavior_velocity_planner/test/src/test_utilization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ TEST(specialInterpolation, specialInterpolation)
const auto genPath = [](const auto p, const auto v) {
if (p.size() != v.size()) throw std::invalid_argument("different size is not expected");
Path path;
for (int i = 0; i < p.size(); ++i) {
for (size_t i = 0; i < p.size(); ++i) {
PathPoint pp;
pp.pose.position.x = p.at(i);
pp.longitudinal_velocity_mps = v.at(i);
Expand All @@ -111,7 +111,7 @@ TEST(specialInterpolation, specialInterpolation)
constexpr auto length = 5.0;
constexpr auto interval = 1.0;

const auto calcStopDist = [&](const auto & px, const auto & vx) {
const auto calcInterpolatedStopDist = [&](const auto & px, const auto & vx) {
const auto path = genPath(px, vx);
const auto res = interpolatePath(path, length, interval);
// DEBUG_PRINT_PATH(path);
Expand All @@ -123,62 +123,62 @@ TEST(specialInterpolation, specialInterpolation)
{
const std::vector<double> px{0.0, 1.0, 2.0, 3.0};
const std::vector<double> vx{5.5, 5.5, 0.0, 0.0};
EXPECT_DOUBLE_EQ(calcStopDist(px, vx), 2.0);
EXPECT_DOUBLE_EQ(calcInterpolatedStopDist(px, vx), 2.0);
}

// expected stop position: s=2.1
{
constexpr auto expected = 2.1;
const std::vector<double> px{0.0, 1.0, 2.1, 3.0};
const std::vector<double> vx{5.5, 5.5, 0.0, 0.0};
EXPECT_DOUBLE_EQ(calcStopDist(px, vx), expected);
EXPECT_DOUBLE_EQ(calcInterpolatedStopDist(px, vx), expected);
}

// expected stop position: s=2.001
{
constexpr auto expected = 2.001;
const std::vector<double> px{0.0, 1.0, 2.001, 3.0};
const std::vector<double> vx{5.5, 5.5, 0.000, 0.0};
EXPECT_DOUBLE_EQ(calcStopDist(px, vx), expected);
EXPECT_DOUBLE_EQ(calcInterpolatedStopDist(px, vx), expected);
}

// expected stop position: s=2.001
{
constexpr auto expected = 2.001;
const std::vector<double> px{0.0, 1.0, 1.999, 2.0, 2.001, 3.0};
const std::vector<double> vx{5.5, 5.5, 5.555, 5.5, 0.000, 0.0};
EXPECT_DOUBLE_EQ(calcStopDist(px, vx), expected);
EXPECT_DOUBLE_EQ(calcInterpolatedStopDist(px, vx), expected);
}

// expected stop position: s=2.0
{
constexpr auto expected = 2.0;
const std::vector<double> px{0.0, 1.0, 1.999, 2.0, 2.001, 3.0};
const std::vector<double> vx{5.5, 5.5, 5.555, 0.0, 0.000, 0.0};
EXPECT_DOUBLE_EQ(calcStopDist(px, vx), expected);
EXPECT_DOUBLE_EQ(calcInterpolatedStopDist(px, vx), expected);
}

// expected stop position: s=1.999
{
constexpr auto expected = 1.999;
const std::vector<double> px{0.0, 1.0, 1.999, 3.0};
const std::vector<double> vx{5.5, 5.5, 0.000, 0.0};
EXPECT_DOUBLE_EQ(calcStopDist(px, vx), expected);
EXPECT_DOUBLE_EQ(calcInterpolatedStopDist(px, vx), expected);
}

// expected stop position: s=0.2
{
constexpr auto expected = 0.2;
const std::vector<double> px{0.0, 0.1, 0.2, 0.3, 0.4};
const std::vector<double> vx{5.5, 5.5, 0.0, 0.0, 0.0};
EXPECT_DOUBLE_EQ(calcStopDist(px, vx), expected);
EXPECT_DOUBLE_EQ(calcInterpolatedStopDist(px, vx), expected);
}

// expected stop position: s=0.4
{
constexpr auto expected = 0.4;
const std::vector<double> px{0.0, 0.1, 0.2, 0.3, 0.4};
const std::vector<double> vx{5.5, 5.5, 5.5, 5.5, 0.0};
EXPECT_DOUBLE_EQ(calcStopDist(px, vx), expected);
EXPECT_DOUBLE_EQ(calcInterpolatedStopDist(px, vx), expected);
}
}

0 comments on commit ac73fdc

Please sign in to comment.