diff options
author | hanemile <hanemile@protonmail.com> | 2018-11-03 19:40:47 +0100 |
---|---|---|
committer | hanemile <hanemile@protonmail.com> | 2018-11-03 19:40:47 +0100 |
commit | 6916c9a5f225cd2312984c11c1770bfa792d0105 (patch) | |
tree | da1dfeb4434642e4ac91af9dbab9c7bec6f2623e | |
parent | 668440ed0a13fa7e5557fe1b5e7e14322c87f714 (diff) |
Implemented all possible cases for the Insert method
-rw-r--r-- | structs_test.go | 20 |
1 files changed, 15 insertions, 5 deletions
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) } /*############################################################ |