Loading src/test/java/object_detection/PointTests.java 0 → 100644 +51 −0 Original line number Diff line number Diff line package object_detection; import static org.junit.jupiter.api.Assertions.*; import object_detection.types.*; import org.junit.jupiter.api.Test; class PointTests { @Test void testPointCreation() { Point point = new Point(1.0f, 2.0f, 3.0f); assertNotNull(point); assertEquals(1.0f, point.getX()); assertEquals(2.0f, point.getY()); assertEquals(3.0f, point.getZ()); } // @Test // void testPointEquality() { // Point p1 = new Point(1.005f, 2.005f, 3.005f); // Point p2 = new Point(1.006f, 2.006f, 3.006f); // assertTrue(Point.equals(p1, p2, 0.01f)); // assertFalse(Point.equals(p1, p2, 0.0001f)); // } // @Test // void testPointPrecisionEquality() { // Point p1 = new Point(0.0000001f, 0.0000001f, 0.0000001f); // Point p2 = new Point(0.0000002f, 0.0000002f, 0.0000002f); // assertFalse(Point.equals(p1, p2, 0.00000001f)); // } @Test void testMultiplePointsAddition() { PointSet ps = new PointSet(); ps.addPoint(new Point(1.0f, 2.0f, 3.0f)); ps.addPoint(new Point(4.0f, 5.0f, 6.0f)); assertEquals(2, ps.getPoints().size()); } @Test void testDuplicatePointsHandling() { PointSet ps = new PointSet(); Point p = new Point(1.0f, 2.0f, 3.0f); ps.addPoint(p); ps.addPoint(p); // Attempt to add the same point assertEquals(1, ps.getPoints().size()); // Assuming duplicates are not allowed } } Loading
src/test/java/object_detection/PointTests.java 0 → 100644 +51 −0 Original line number Diff line number Diff line package object_detection; import static org.junit.jupiter.api.Assertions.*; import object_detection.types.*; import org.junit.jupiter.api.Test; class PointTests { @Test void testPointCreation() { Point point = new Point(1.0f, 2.0f, 3.0f); assertNotNull(point); assertEquals(1.0f, point.getX()); assertEquals(2.0f, point.getY()); assertEquals(3.0f, point.getZ()); } // @Test // void testPointEquality() { // Point p1 = new Point(1.005f, 2.005f, 3.005f); // Point p2 = new Point(1.006f, 2.006f, 3.006f); // assertTrue(Point.equals(p1, p2, 0.01f)); // assertFalse(Point.equals(p1, p2, 0.0001f)); // } // @Test // void testPointPrecisionEquality() { // Point p1 = new Point(0.0000001f, 0.0000001f, 0.0000001f); // Point p2 = new Point(0.0000002f, 0.0000002f, 0.0000002f); // assertFalse(Point.equals(p1, p2, 0.00000001f)); // } @Test void testMultiplePointsAddition() { PointSet ps = new PointSet(); ps.addPoint(new Point(1.0f, 2.0f, 3.0f)); ps.addPoint(new Point(4.0f, 5.0f, 6.0f)); assertEquals(2, ps.getPoints().size()); } @Test void testDuplicatePointsHandling() { PointSet ps = new PointSet(); Point p = new Point(1.0f, 2.0f, 3.0f); ps.addPoint(p); ps.addPoint(p); // Attempt to add the same point assertEquals(1, ps.getPoints().size()); // Assuming duplicates are not allowed } }