返回 DeepSeek-Reasonix
goal_spend_budget_test.go
根目录 / internal / control / goal_spend_budget_test.go
1 package control
2
3 import (
4 "testing"
5
6 "reasonix/internal/provider"
7 )
8
9 func billedGoalTurn() []provider.Chunk {
10 return []provider.Chunk{
11 {Type: provider.ChunkText, Text: "still working."},
12 {Type: provider.ChunkUsage, Usage: &provider.Usage{
13 PromptTokens: 100, CompletionTokens: 10, TotalTokens: 110, RequestCount: 1}},
14 {Type: provider.ChunkDone},
15 }
16 }
17
18 // The class-derived turn quota is gone: a Goal is no longer bounded by a number
19 // guessed from its own text. What bounds it is what the user configures.
20 func TestGoalStartsWithNoTurnQuota(t *testing.T) {
21 prov := &scriptedTurns{turns: [][]provider.Chunk{billedGoalTurn()}}
22 c, _, _ := goalRuntimeController(t, prov, &fakeGoalEvaluator{outcome: "complete", reason: "done"})
23 c.SetGoal("research the whole subsystem end to end")
24
25 if rt := c.GoalRuntime(); rt.TurnsLimit != 0 || rt.TokensLimit != 0 {
26 t.Fatalf("runtime = %+v, want an unbounded goal out of the box", rt)
27 }
28 }
29
29 lines GO