TestHeap_Close tests Heap.Close and Heap.IsClosed functions.
(t *testing.T)
| 290 | |
| 291 | // TestHeap_Close tests Heap.Close and Heap.IsClosed functions. |
| 292 | func TestHeap_Close(t *testing.T) { |
| 293 | h := NewHeap(testHeapObjectKeyFunc, compareInts) |
| 294 | h.Add(mkHeapObj("foo", 10)) |
| 295 | h.Add(mkHeapObj("bar", 1)) |
| 296 | |
| 297 | if h.IsClosed() { |
| 298 | t.Fatalf("didn't expect heap to be closed") |
| 299 | } |
| 300 | h.Close() |
| 301 | if !h.IsClosed() { |
| 302 | t.Fatalf("expect heap to be closed") |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | // TestHeap_List tests Heap.List function. |
| 307 | func TestHeap_List(t *testing.T) { |