(t *testing.T)
| 277 | } |
| 278 | |
| 279 | func Test_indexedHeap_PushAndOps(t *testing.T) { |
| 280 | t.Parallel() |
| 281 | |
| 282 | h := &indexedHeap{} |
| 283 | |
| 284 | // put inserts entries and returns tracking indices. |
| 285 | idxA := h.put("a", 30, 1) |
| 286 | idxB := h.put("b", 10, 2) |
| 287 | idxC := h.put("c", 20, 3) |
| 288 | require.Equal(t, 3, h.Len()) |
| 289 | |
| 290 | // The lowest expiration must come out first. |
| 291 | key, _ := h.removeFirst() |
| 292 | require.Equal(t, "b", key) |
| 293 | |
| 294 | // Remove an arbitrary tracked entry. |
| 295 | key, _ = h.remove(idxC) |
| 296 | require.Equal(t, "c", key) |
| 297 | _ = idxA |
| 298 | _ = idxB |
| 299 | |
| 300 | // Directly exercise the heap.Interface Push method (not used by put()). |
| 301 | h2 := &indexedHeap{indices: []int{0}} |
| 302 | heap.Push(h2, heapEntry{key: "z", exp: 5, idx: 0}) |
| 303 | require.Equal(t, 1, h2.Len()) |
| 304 | require.Equal(t, "z", h2.entries[0].key) |
| 305 | } |
| 306 | |
| 307 | func Test_parseUintDirective(t *testing.T) { |
| 308 | t.Parallel() |
nothing calls this directly
no test coverage detected