blob: d48545c6ded0674e3846955b2573591ce758da8d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package quadtree
import (
"math/rand"
"testing"
)
func TestMaxHeap(t *testing.T) {
r := rand.New(rand.NewSource(22))
for i := 1; i < 100; i++ {
h := make(maxHeap, 0, i)
for j := 0; j < i; j++ {
h.Push(nil, r.Float64())
}
current := h[0].distance
h.Pop()
for len(h) > 0 {
next := h[0].distance
h.Pop()
if next > current {
t.Errorf("incorrect")
}
current = next
}
}
}
|