Skip to content

Commit 7e5ad45

Browse files
committed
MInor tests
Signed-off-by: Alberto Tudela <[email protected]>
1 parent c088640 commit 7e5ad45

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

test/test_segmentations.cpp

+13-5
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,17 @@ TEST(JumpDistanceTest, isJumpBetween) {
149149
slg::Point2D point1(0.0, 0.0);
150150
slg::Point2D point2(0.5, 0.35);
151151

152+
// Calculate the jump distance when one of the points is NaN
153+
bool is_jump = segmentation.is_jump_between(point1, slg::Point2D::quiet_NaN());
154+
EXPECT_TRUE(is_jump);
155+
is_jump = segmentation.is_jump_between(slg::Point2D::quiet_NaN(), point2);
156+
EXPECT_TRUE(is_jump);
157+
is_jump = segmentation.is_jump_between(slg::Point2D::quiet_NaN(), slg::Point2D::quiet_NaN());
158+
EXPECT_TRUE(is_jump);
159+
152160
// Calculate the jump distance using Lee method
153161
segmentation.initialize_segmentation(0.1, 0.2, 0.3, "lee");
154-
bool is_jump = segmentation.is_jump_between(point1, point2);
162+
is_jump = segmentation.is_jump_between(point1, point2);
155163
// Check the result: 0.61 > 1.0 is false
156164
EXPECT_FALSE(is_jump);
157165

@@ -199,7 +207,7 @@ TEST(JumpDistanceTest, performSegmentation) {
199207
segmentation.initialize_segmentation(0.1, 0.2, 0.3, "test");
200208

201209
// Set points with a distance of 0.05
202-
std::vector<slg::Point2D> points = create_points(3, 0.05);
210+
std::vector<slg::Point2D> points = create_points(5, 0.05);
203211
points.push_back(slg::Point2D::quiet_NaN());
204212
// Perform the segmentation
205213
std::vector<slg::Segment2D> segments;
@@ -209,12 +217,12 @@ TEST(JumpDistanceTest, performSegmentation) {
209217
// and the distance between points is 0.05
210218
EXPECT_EQ(segments.size(), 1);
211219
// Check the number of points in the segment
212-
// Should be 3 points in the segment
220+
// Should be 5 points in the segment
213221
// as the last point is a NaN point
214-
EXPECT_EQ(segments[0].size(), 3);
222+
EXPECT_EQ(segments[0].size(), points.size()-1);
215223

216224
// Now we set the points with a distance of 1.0
217-
points = create_points(3, 1.0);
225+
points = create_points(5, 1.0);
218226
// Perform the segmentation
219227
segments.clear();
220228
segmentation.perform_segmentation(points, segments);

0 commit comments

Comments
 (0)