From ceaa8056213ac425d4a808c4b5685d9d6abda81e Mon Sep 17 00:00:00 2001 From: hanemile Date: Tue, 6 Nov 2018 16:16:09 +0100 Subject: Rebuild the function that builds the quadtree and changes all the empty quadtrees from the example to nil --- structs_test.go | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'structs_test.go') diff --git a/structs_test.go b/structs_test.go index 3abb47f..0989753 100644 --- a/structs_test.go +++ b/structs_test.go @@ -165,6 +165,7 @@ func TestInsert(t *testing.T) { func TestPrint(t *testing.T) { // Define a testQuadTree + var testQuadTree = Quadtree{ nodeCapacity: 0, boundary: BoundingBox{ @@ -185,11 +186,26 @@ func TestPrint(t *testing.T) { halfDimension: 2, }, pointsSlice: nil, - northWest: &Quadtree{}, - northEast: &Quadtree{}, - southWest: &Quadtree{}, - southEast: &Quadtree{}, - depth: 1, + northWest: &Quadtree{ + nodeCapacity: 0, + boundary: BoundingBox{ + center: Coord{ + x: 3, + y: 3, + }, + halfDimension: 1, + }, + pointsSlice: nil, + northWest: nil, + northEast: nil, + southWest: nil, + southEast: nil, + depth: 2, + }, + northEast: nil, + southWest: nil, + southEast: nil, + depth: 1, }, northEast: &Quadtree{ nodeCapacity: 0, @@ -201,10 +217,10 @@ func TestPrint(t *testing.T) { halfDimension: 2, }, pointsSlice: nil, - northWest: &Quadtree{}, - northEast: &Quadtree{}, - southWest: &Quadtree{}, - southEast: &Quadtree{}, + northWest: nil, + northEast: nil, + southWest: nil, + southEast: nil, depth: 1, }, southWest: &Quadtree{ @@ -217,10 +233,10 @@ func TestPrint(t *testing.T) { halfDimension: 2, }, pointsSlice: nil, - northWest: &Quadtree{}, - northEast: &Quadtree{}, - southWest: &Quadtree{}, - southEast: &Quadtree{}, + northWest: nil, + northEast: nil, + southWest: nil, + southEast: nil, depth: 1, }, southEast: &Quadtree{ @@ -233,10 +249,10 @@ func TestPrint(t *testing.T) { halfDimension: 2, }, pointsSlice: nil, - northWest: &Quadtree{}, - northEast: &Quadtree{}, - southWest: &Quadtree{}, - southEast: &Quadtree{}, + northWest: nil, + northEast: nil, + southWest: nil, + southEast: nil, depth: 1, }, depth: 0, -- cgit 1.4.1