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

Function TestScoredSection_Sorting

pkg/agent/prompt_compression_test.go:201–222  ·  view source on GitHub ↗

TestScoredSection_Sorting 测试评分排序

(t *testing.T)

Source from the content-addressed store, hash-verified

199
200// TestScoredSection_Sorting 测试评分排序
201func TestScoredSection_Sorting(t *testing.T) {
202 compressor := &EnhancedPromptCompressor{
203 language: "zh",
204 }
205
206 sections := []string{
207 "Regular content",
208 "## IMPORTANT Security\nCritical section",
209 "## Tools Manual\nTools description",
210 "Some other text",
211 }
212
213 scored := compressor.scoreSections(sections, []string{"Tools Manual"})
214
215 // 验证排序(高分在前)
216 for i := 0; i < len(scored)-1; i++ {
217 if scored[i].Score < scored[i+1].Score {
218 t.Errorf("Sections not sorted by score: %f < %f",
219 scored[i].Score, scored[i+1].Score)
220 }
221 }
222}
223
224// generateLongTestPrompt 生成测试用的长 prompt
225func generateLongTestPrompt() string {

Callers

nothing calls this directly

Calls 1

scoreSectionsMethod · 0.95

Tested by

no test coverage detected