Advertisement
Guest User

QuadTreeTests

a guest
Feb 3rd, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. @Test
  2.     public void TestMethod3() {
  3.         QuadTree<TestBox> quadTree = new QuadTree<>(WorldWidth, WorldHeight);
  4.  
  5.         List<List<TestBox>> items = new ArrayList<>();
  6.  
  7.         List<TestBox> t1 = new ArrayList<>();
  8.         t1.add(new TestBox(110, 0));
  9.  
  10.         List<TestBox> t2 = new ArrayList<>();
  11.         t2.add(new TestBox(10, 0));
  12.  
  13.         List<TestBox> t3 = new ArrayList<>();
  14.         t3.add(new TestBox(10, 0));
  15.         t3.add(new TestBox(10, 110));
  16.  
  17.         items.add(t1);
  18.         items.add(t2);
  19.         items.add(t3);
  20.  
  21.         for (List<TestBox> item : items) {
  22.             for (TestBox testBox : item) {
  23.                 quadTree.insert(testBox);
  24.             }
  25.         }
  26.  
  27. ...
  28.  
  29.         Rectangle thirdQuadrant = GetSubquadrantBounds(3);
  30.         List<TestBox> elementsThird = quadTree.report(thirdQuadrant);
  31.         index = 0;
  32.         for (TestBox testBox : items.get(2)) {
  33.             Assert.assertEquals(testBox, elementsThird.get(index++));
  34.         }
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement