Permalink
Browse files

move test utility function to tests file

  • Loading branch information...
1 parent 8deddea commit 7900b7751a427a55a9d95023d3698f83e34127dd @dhconnelly committed Apr 2, 2012
Showing with 17 additions and 17 deletions.
  1. +0 −17 rtree.go
  2. +17 −0 rtree_test.go
View
@@ -368,23 +368,6 @@ func (tree *Rtree) findLeaf(n *node, obj Spatial) *node {
return nil
}
-func items(n *node) chan Spatial {
- ch := make(chan Spatial)
- go func() {
- for _, e := range n.entries {
- if n.leaf {
- ch <- e.obj
- } else {
- for obj := range items(e.child) {
- ch <- obj
- }
- }
- }
- close(ch)
- }()
- return ch
-}
-
// condenseTree deletes underflowing nodes and propagates the changes upwards.
func (tree *Rtree) condenseTree(n *node) {
deleted := []*node{}
View
@@ -40,6 +40,23 @@ func printEntry(e entry, level int) {
fmt.Println()
}
+func items(n *node) chan Spatial {
+ ch := make(chan Spatial)
+ go func() {
+ for _, e := range n.entries {
+ if n.leaf {
+ ch <- e.obj
+ } else {
+ for obj := range items(e.child) {
+ ch <- obj
+ }
+ }
+ }
+ close(ch)
+ }()
+ return ch
+}
+
func verify(t *testing.T, n *node) {
if n.leaf {
return

0 comments on commit 7900b77

Please sign in to comment.