MCPcopy Create free account
hub / github.com/astercloud/aster / TestChainMaxSteps

Function TestChainMaxSteps

pkg/reasoning/reasoning_test.go:53–76  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

51}
52
53func TestChainMaxSteps(t *testing.T) {
54 chain := NewChain(ChainConfig{MaxSteps: 2})
55
56 step := Step{
57 Title: "Test Step",
58 Confidence: 0.9,
59 NextAction: NextActionContinue,
60 }
61
62 // 添加第一个步骤
63 if err := chain.AddStep(step); err != nil {
64 t.Fatalf("failed to add first step: %v", err)
65 }
66
67 // 添加第二个步骤
68 if err := chain.AddStep(step); err != nil {
69 t.Fatalf("failed to add second step: %v", err)
70 }
71
72 // 尝试添加第三个步骤(应该失败)
73 if err := chain.AddStep(step); err == nil {
74 t.Error("expected error when exceeding max steps")
75 }
76}
77
78func TestChainShouldContinue(t *testing.T) {
79 tests := []struct {

Callers

nothing calls this directly

Calls 3

AddStepMethod · 0.95
NewChainFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected