(t *testing.T)
| 165 | } |
| 166 | |
| 167 | func TestHeap(t *testing.T) { |
| 168 | h := &postHeap{} |
| 169 | es := []postEntry{7, 4, 3, 2, 4} |
| 170 | for _, e := range es { |
| 171 | h.addMem([]postEntry{e}) |
| 172 | } |
| 173 | if len(h.ch) != len(es) { |
| 174 | t.Fatalf("wrong heap size: %d, want %d", len(h.ch), len(es)) |
| 175 | } |
| 176 | for a, b := h.next(), h.next(); b.trigram() != (1<<24 - 1); a, b = b, h.next() { |
| 177 | if a > b { |
| 178 | t.Fatalf("%d should <= %d", a, b) |
| 179 | } |
| 180 | } |
| 181 | } |