MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestBudget

Function TestBudget

internal/ctx/ctx_test.go:593–607  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

591 }
592 }
593 if !sawTask {
594 t.Fatalf("original task must stay anchored even when a nudge is the newest message: %+v", r.Messages)
595 }
596}
597
598func TestBudget(t *testing.T) {
599 // Reference the constants directly so a future FixedSystem/FixedTools/headroom
600 // tweak doesn't trip a magic-number mismatch absent a real regression.
601 // 65k: ctxSize/8 = 8192, just above the 8k floor.
602 if raw := 65536 - FixedSystem - FixedTools - 8192; Budget(65536) != raw-raw/budgetHeadroomDivisor {
603 t.Fatalf("budget wrong at 65k: %d", Budget(65536))
604 }
605 // 262k: ctxSize/8 = 32768, matches a common thinking-mode default.
606 if raw := 262144 - FixedSystem - FixedTools - 32768; Budget(262144) != raw-raw/budgetHeadroomDivisor {
607 t.Fatalf("budget wrong at 262k: %d", Budget(262144))
608 }
609 if Budget(1000) != 0 {
610 t.Fatal("budget must floor at 0")

Callers

nothing calls this directly

Calls 1

BudgetFunction · 0.85

Tested by

no test coverage detected