Loading src/test/java/object_detection/BoundingBoxTests.java 0 → 100644 +15 −0 Original line number Diff line number Diff line class BoundingBoxTests { @Test void testPointWithinBoundingBox() { Point2D tr = new Point2D(10, 10); Point2D tl = new Point2D(0, 10); Point2D br = new Point2D(10, 0); Point2D bl = new Point2D(0, 0); BoundingBox box = new BoundingBox(tr, tl, br, bl); assertTrue(box.within(new Point2D(5, 5))); assertFalse(box.within(new Point2D(10, 10))); // edge case: point on the boundary assertFalse(box.within(new Point2D(-1, 5))); // outside box } } src/test/java/object_detection/ObjectSetTests.java 0 → 100644 +22 −0 Original line number Diff line number Diff line class ObjectSetTests { @Test void testObjectCreationAndComparison() { ObjectSet os = new ObjectSet(); int objId1 = os.makeObject(new Point(1, 2, 3), new Point(4, 5, 6)); int objId2 = os.makeObject(new Point(1, 2, 3), new Point(4, 5, 6)); assertEquals(2, ObjectSet.objects.size()); assertTrue(ObjectSet.compareObjects(objId1, objId2)); } @Test void testObjectCombination() { ObjectSet os = new ObjectSet(); int objId1 = os.makeObject(new Point(0, 0, 0)); int objId2 = os.makeObject(new Point(1, 1, 1)); os.combineObjects(objId1, objId2); assertEquals(1, ObjectSet.objects.size()); // should be combined into one } } src/test/java/object_detection/PointTests.java 0 → 100644 +24 −0 Original line number Diff line number Diff line package object_detection.types; import static org.junit.jupiter.api.Assertions.*; 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)); } } Loading
src/test/java/object_detection/BoundingBoxTests.java 0 → 100644 +15 −0 Original line number Diff line number Diff line class BoundingBoxTests { @Test void testPointWithinBoundingBox() { Point2D tr = new Point2D(10, 10); Point2D tl = new Point2D(0, 10); Point2D br = new Point2D(10, 0); Point2D bl = new Point2D(0, 0); BoundingBox box = new BoundingBox(tr, tl, br, bl); assertTrue(box.within(new Point2D(5, 5))); assertFalse(box.within(new Point2D(10, 10))); // edge case: point on the boundary assertFalse(box.within(new Point2D(-1, 5))); // outside box } }
src/test/java/object_detection/ObjectSetTests.java 0 → 100644 +22 −0 Original line number Diff line number Diff line class ObjectSetTests { @Test void testObjectCreationAndComparison() { ObjectSet os = new ObjectSet(); int objId1 = os.makeObject(new Point(1, 2, 3), new Point(4, 5, 6)); int objId2 = os.makeObject(new Point(1, 2, 3), new Point(4, 5, 6)); assertEquals(2, ObjectSet.objects.size()); assertTrue(ObjectSet.compareObjects(objId1, objId2)); } @Test void testObjectCombination() { ObjectSet os = new ObjectSet(); int objId1 = os.makeObject(new Point(0, 0, 0)); int objId2 = os.makeObject(new Point(1, 1, 1)); os.combineObjects(objId1, objId2); assertEquals(1, ObjectSet.objects.size()); // should be combined into one } }
src/test/java/object_detection/PointTests.java 0 → 100644 +24 −0 Original line number Diff line number Diff line package object_detection.types; import static org.junit.jupiter.api.Assertions.*; 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)); } }