Skip to content

Commit d8d9d40

Browse files
Add unit test for Delaunay triangulation
1 parent 93a5505 commit d8d9d40

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.thealgorithms.geometry;
2+
3+
import static org.junit.jupiter.api.Assertions.*;
4+
import java.util.Arrays;
5+
import java.util.List;
6+
import org.junit.jupiter.api.Test;
7+
8+
public class DelaunayTriangulationTest {
9+
10+
@Test
11+
void testBasicTriangulation() {
12+
List<Point> points = Arrays.asList(
13+
new Point(0, 0), new Point(1, 0),
14+
new Point(0, 1), new Point(1, 1)
15+
);
16+
17+
List<DelaunayTriangulation.Triangle> triangles = DelaunayTriangulation.triangulate(points);
18+
assertFalse(triangles.isEmpty());
19+
assertTrue(triangles.size() >= 2); // At least 2 triangles for a square
20+
}
21+
}

0 commit comments

Comments
 (0)