diff options
author | hanemile <hanemile@protonmail.com> | 2018-11-03 19:41:14 +0100 |
---|---|---|
committer | hanemile <hanemile@protonmail.com> | 2018-11-03 19:41:14 +0100 |
commit | 434e3dc2f25ffa8ff2d302dee2495ade6167c6d5 (patch) | |
tree | 1330171526047ca35f780a0de4cbc921f29d91b9 | |
parent | 6916c9a5f225cd2312984c11c1770bfa792d0105 (diff) |
Added a test that tests printing a quadtree
-rw-r--r-- | structs_test.go | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/structs_test.go b/structs_test.go index cc62016..4be947b 100644 --- a/structs_test.go +++ b/structs_test.go @@ -161,6 +161,91 @@ func TestInsert(t *testing.T) { } +// test printing a quadtree +func TestPrint(t *testing.T) { + + // Define a testQuadTree + var testQuadTree = Quadtree{ + nodeCapacity: 0, + boundary: BoundingBox{ + center: Coord{ + x: 0, + y: 0, + }, + halfDimension: 4, + }, + pointsSlice: nil, + northWest: &Quadtree{ + nodeCapacity: 0, + boundary: BoundingBox{ + center: Coord{ + x: 2, + y: 2, + }, + halfDimension: 2, + }, + pointsSlice: nil, + northWest: &Quadtree{}, + northEast: &Quadtree{}, + southWest: &Quadtree{}, + southEast: &Quadtree{}, + depth: 1, + }, + northEast: &Quadtree{ + nodeCapacity: 0, + boundary: BoundingBox{ + center: Coord{ + x: -2, + y: 2, + }, + halfDimension: 2, + }, + pointsSlice: nil, + northWest: &Quadtree{}, + northEast: &Quadtree{}, + southWest: &Quadtree{}, + southEast: &Quadtree{}, + depth: 1, + }, + southWest: &Quadtree{ + nodeCapacity: 0, + boundary: BoundingBox{ + center: Coord{ + x: 2, + y: -2, + }, + halfDimension: 2, + }, + pointsSlice: nil, + northWest: &Quadtree{}, + northEast: &Quadtree{}, + southWest: &Quadtree{}, + southEast: &Quadtree{}, + depth: 1, + }, + southEast: &Quadtree{ + nodeCapacity: 0, + boundary: BoundingBox{ + center: Coord{ + x: -2, + y: -2, + }, + halfDimension: 2, + }, + pointsSlice: nil, + northWest: &Quadtree{}, + northEast: &Quadtree{}, + southWest: &Quadtree{}, + southEast: &Quadtree{}, + depth: 1, + }, + depth: 0, + } + + // Print the test-QuadTree + testQuadTree.Print() +} + /*############################################################ BEYOND THIS POINT: EXAMPLES ############################################################*/ |