Skip to content

Commit 1859d48

Browse files
committed
fix unit tests
1 parent d7d7cab commit 1859d48

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

src/software/ai/hl/stp/tactic/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ cc_library(
154154
":primitive",
155155
"//proto/message_translation:tbots_protobuf",
156156
"//software/util/hash:hash_combine",
157+
"//software/ai/navigator/obstacle:robot_navigation_obstacle_factory",
157158
]
158159
)
159160

src/software/ai/hl/stp/tactic/vis_proto_deduper_test.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11

22
#include "software/ai/hl/stp/tactic/vis_proto_deduper.h"
33
#include "software/ai/navigator/obstacle/obstacle.hpp"
4+
#include "software/ai/navigator/obstacle/robot_navigation_obstacle_factory.h"
45
#include "software/geom/polygon.h"
56
#include "software/geom/point.h"
67

78
#include <gtest/gtest.h>
89
#include <memory>
910
#include <vector>
1011

11-
// Helper to create a unique obstacle based on a position offset
12-
// This ensures we have distinct geometries to hash.
13-
ObstaclePtr createTestObstacle(double x, double y)
14-
{
15-
auto polygon = Polygon({Point(x, y), Point(x + 1.0, y + 1.0), Point(x - 1.0, y - 1.0)});
16-
return std::make_shared<Obstacle>(polygon);
17-
}
12+
1813

1914
class VisProtoDeduperTest : public ::testing::Test
2015
{
2116
protected:
17+
RobotNavigationObstacleFactory obstacle_factory =
18+
RobotNavigationObstacleFactory(TbotsProto::RobotNavigationObstacleConfig());
19+
2220
// Helper to extract the list of obstacles from the proto message for easy verification
2321
std::vector<TbotsProto::Obstacle> getObstaclesFromProto(const TbotsProto::ObstacleList& msg)
2422
{
@@ -27,7 +25,15 @@ class VisProtoDeduperTest : public ::testing::Test
2725
{
2826
obstacles.push_back(obs);
2927
}
30-
return obstacles;
28+
return obstacles;;
29+
}
30+
31+
// Helper to create a unique obstacle based on a position offset
32+
// This ensures we have distinct geometries to hash.
33+
ObstaclePtr createTestObstacle(double x, double y)
34+
{
35+
auto polygon = Polygon({Point(x, y), Point(x + 1.0, y), Point(x, y + 1.0)});
36+
return obstacle_factory.createFromShape(polygon);
3137
}
3238
};
3339

0 commit comments

Comments
 (0)