From 6916c9a5f225cd2312984c11c1770bfa792d0105 Mon Sep 17 00:00:00 2001 From: hanemile Date: Sat, 3 Nov 2018 19:40:47 +0100 Subject: Implemented all possible cases for the Insert method --- structs_test.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'structs_test.go') diff --git a/structs_test.go b/structs_test.go index 68b4c94..cc62016 100644 --- a/structs_test.go +++ b/structs_test.go @@ -143,12 +143,22 @@ func TestInsert(t *testing.T) { // create a new Quadtree using the boundary var newQuadtree = *NewQuadtree(boundary, 0) - // Define a star and Insert it into the Quadtree - singleCoord := Coord{0.5, 0.5} - newQuadtree.Insert(singleCoord) + // Case 1: Add a star to the North-West Boundary + singleCoordNW := Coord{-0.5, 0.5} + newQuadtree.Insert(singleCoordNW) + + // Case 2: Add a star to the North-East Boundary + singleCoordNE := Coord{0.5, 0.5} + newQuadtree.Insert(singleCoordNE) + + // Case 3: Add a star to the South-West Boundary + singleCoordSW := Coord{0.5, -0.5} + newQuadtree.Insert(singleCoordSW) + + // Case 4: Add a star to the South-East Boundary + singleCoordSE := Coord{-0.5, -0.5} + newQuadtree.Insert(singleCoordSE) - // Print the stuff generated - t.Logf("Complete Tree: %v\n", newQuadtree.northEast.southWest.southWest.northEast) } /*############################################################ -- cgit 1.4.1