Skip to content

Commit

Permalink
feat(traffic_light_fine_detector): remove test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Shin-kyoto <[email protected]>
  • Loading branch information
Shin-kyoto committed May 30, 2024
1 parent f54a2bb commit db9db2a
Showing 1 changed file with 0 additions and 80 deletions.
80 changes: 0 additions & 80 deletions perception/traffic_light_fine_detector/test/test_nodelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@

#include "traffic_light_fine_detector/nodelet.hpp"

#include <gtest/gtest.h>

sensor_msgs::msg::RegionOfInterest createMapBasedBbox(
const uint32_t x_offset, const uint32_t y_offset, const uint32_t width, const uint32_t height)
{
sensor_msgs::msg::RegionOfInterest bbox;
bbox.x_offset = x_offset;
bbox.y_offset = y_offset;
bbox.width = width;
bbox.height = height;
return bbox;
}

tensorrt_yolox::Object createYoloxBbox(
const int32_t x_offset, const int32_t y_offset, const int32_t width, const int32_t height,
const float score, const int32_t type)
Expand All @@ -40,70 +27,3 @@ tensorrt_yolox::Object createYoloxBbox(
bbox.type = type;
return bbox;
}

Check warning on line 29 in perception/traffic_light_fine_detector/test/test_nodelet.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Excess Number of Function Arguments

createYoloxBbox has 6 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

TEST(CalWeightedIouTest, NoOverlap)
{
const sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(0, 0, 10, 10);
const tensorrt_yolox::Object yolox_bbox = createYoloxBbox(20, 20, 10, 10, 0.9f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.0f);
}

TEST(CalWeightedIouTest, PartiallyOverlap1)
{
const sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(15, 15, 10, 10);
const tensorrt_yolox::Object yolox_bbox = createYoloxBbox(20, 20, 10, 10, 0.7f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.1f);
}

TEST(CalWeightedIouTest, PartiallyOverlap2)
{
const sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(0, 0, 10, 10);
const tensorrt_yolox::Object yolox_bbox = createYoloxBbox(-5, -5, 10, 10, 0.7f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.1f);
}

TEST(CalWeightedIouTest, Included1)
{
const sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(20, 20, 10, 10);
const tensorrt_yolox::Object yolox_bbox = createYoloxBbox(20, 20, 10, 10, 0.5f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.5f);
}

TEST(CalWeightedIouTest, Included2)
{
const sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(20, 20, 100, 100);
const tensorrt_yolox::Object yolox_bbox = createYoloxBbox(20, 20, 10, 10, 0.5f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.005f);
}

TEST(CalWeightedIouTest, Zero)
{
const sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(0, 0, 0, 0);
const tensorrt_yolox::Object yolox_bbox = createYoloxBbox(0, 0, 0, 0, 0.5f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.0f);
}

TEST(CalWeightedIouTest, Negative)
{
const sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(0, 0, 10, 10);
const tensorrt_yolox::Object yolox_bbox = createYoloxBbox(-5, -5, -5, 10, 0.5f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.0f);
}

// This test case should be passed but it fails because of inappropriate type casting.
// So it is disabled now. Current result is 0.1097561, but it should be 0.0.
TEST(CalWeightedIouTest, DISABLED_Uint32Max)
{
const sensor_msgs::msg::RegionOfInterest map_based_bbox =
createMapBasedBbox(UINT32_MAX, UINT32_MAX, 10, 10);
const tensorrt_yolox::Object yolox_bbox = createYoloxBbox(-5, -5, 10, 10, 0.5f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.0f);
}

0 comments on commit db9db2a

Please sign in to comment.