Add files via upload

This commit is contained in:
公明
2026-05-14 19:23:27 +08:00
committed by GitHub
parent 54dc31a616
commit da369c2edc
75 changed files with 21176 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
package multiagent
import (
"strings"
"testing"
"github.com/cloudwego/eino/adk/prebuilt/planexecute"
)
func TestCapPlanExecuteExecutedSteps_TruncatesLongResult(t *testing.T) {
long := strings.Repeat("x", planExecuteMaxStepResultRunes+500)
steps := []planexecute.ExecutedStep{{Step: "s1", Result: long}}
out := capPlanExecuteExecutedSteps(steps)
if len(out) != 1 {
t.Fatalf("len=%d", len(out))
}
if !strings.Contains(out[0].Result, "truncated") {
t.Fatalf("expected truncation marker in %q", out[0].Result[:80])
}
}
func TestCapPlanExecuteExecutedSteps_FoldsEarlySteps(t *testing.T) {
var steps []planexecute.ExecutedStep
for i := 0; i < planExecuteKeepLastSteps+5; i++ {
steps = append(steps, planexecute.ExecutedStep{Step: "step", Result: "ok"})
}
out := capPlanExecuteExecutedSteps(steps)
if len(out) != planExecuteKeepLastSteps+1 {
t.Fatalf("want %d entries, got %d", planExecuteKeepLastSteps+1, len(out))
}
if out[0].Step != "[Earlier steps — titles only]" {
t.Fatalf("first entry: %#v", out[0])
}
}