Add QuadTree toString() and getChildCountAtPos()

This commit is contained in:
James Seibel
2023-03-25 09:23:24 -05:00
parent a985e1c542
commit 0b05ced5b9
3 changed files with 56 additions and 5 deletions
+13 -1
View File
@@ -529,7 +529,7 @@ public class QuadTreeTest
QuadNode<Integer> rootNode = new QuadNode<>(new DhSectionPos((byte)10, 0, 0), (byte)0);
rootNode.forEachDirectChild((child, childPos) ->
{
rootNode.setValue(childPos, 1, null);
rootNode.setValue(childPos, 1);
});
Assert.assertEquals("node not filled", rootNode.getChildValueCount(), 4);
@@ -543,6 +543,18 @@ public class QuadTreeTest
}
// this is here for quickly testing the toString method, it should never fail
@Test
public void toStringTest()
{
QuadTree<Integer> tree = new QuadTree<>(ROOT_NODE_WIDTH_IN_BLOCKS, new DhBlockPos2D(0, 0), (byte)6);
String treeString = tree.toString();
Assert.assertNotNull(treeString);
Assert.assertNotEquals("", treeString);
}