This commit is contained in:
ponzischeme89
2026-08-16 12:13:51 +12:00
parent bd3732fba5
commit b9374baaf1
47 changed files with 2793 additions and 364 deletions
+14
View File
@@ -141,3 +141,17 @@ func TestQueueOrderIsTotalAndStable(t *testing.T) {
t.Fatalf("claimed %q; more recent demand should win a tie", candidate.ItemID)
}
}
func TestReducingQueueLimitKeepsTheStrongestCandidates(t *testing.T) {
queue := NewQueue(5)
queue.Push(queued("weak", PrioritySpeculative))
queue.Push(queued("ahead", PriorityAhead2))
queue.Push(queued("next", PriorityNext))
queue.SetLimit(2)
pending := queue.Snapshot()
if len(pending) != 2 || pending[0].ItemID != "next" || pending[1].ItemID != "ahead" {
t.Fatalf("reduced queue = %+v; want the two strongest candidates", pending)
}
}