@@ -9,6 +9,11 @@ public class QuadTreeTest {
99 BoundingBox boundingBox = new BoundingBox (new Point (0 , 0 ), 500 );
1010 QuadTree quadTree = new QuadTree (boundingBox , quadTreeCapacity );
1111
12+ @ Test
13+ public void testNullPointInsertIntoQuadTree () {
14+ Assertions .assertFalse (quadTree .insert (null ));
15+ }
16+
1217 @ Test
1318 public void testInsertIntoQuadTree () {
1419 Assertions .assertTrue (quadTree .insert (new Point (10 , -10 )));
@@ -18,12 +23,28 @@ public void testInsertIntoQuadTree() {
1823 Assertions .assertFalse (quadTree .insert (new Point (1050 , 1050 )));
1924 }
2025
26+ @ Test
27+ public void testInsertIntoQuadTreeAndSubDivide () {
28+ Assertions .assertTrue (quadTree .insert (new Point (10 , -10 )));
29+ Assertions .assertTrue (quadTree .insert (new Point (-10 , 10 )));
30+ Assertions .assertTrue (quadTree .insert (new Point (-10 , -10 )));
31+ Assertions .assertTrue (quadTree .insert (new Point (10 , 10 )));
32+ Assertions .assertTrue (quadTree .insert (new Point (-100 , 100 )));
33+ Assertions .assertTrue (quadTree .insert (new Point (100 , -100 )));
34+ Assertions .assertTrue (quadTree .insert (new Point (-100 , -100 )));
35+ Assertions .assertTrue (quadTree .insert (new Point (100 , 100 )));
36+ }
37+
2138 @ Test
2239 public void testQueryInQuadTree () {
2340 quadTree .insert (new Point (10 , -10 ));
2441 quadTree .insert (new Point (-10 , 10 ));
2542 quadTree .insert (new Point (-10 , -10 ));
2643 quadTree .insert (new Point (10 , 10 ));
44+ quadTree .insert (new Point (-100 , 100 ));
45+ quadTree .insert (new Point (100 , -100 ));
46+ quadTree .insert (new Point (-100 , -100 ));
47+ quadTree .insert (new Point (100 , 100 ));
2748
2849 List <Point > points = quadTree .query (new BoundingBox (new Point (0 , 0 ), 100 ));
2950 Assertions .assertEquals (4 , points .size ());
0 commit comments