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

Function TestDetectDuplicates

pkg/memory/quality_analyzer_test.go:96–127  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

94}
95
96func TestDetectDuplicates(t *testing.T) {
97 config := DefaultQualityMetricsConfig()
98 qm := NewQualityMetrics(config)
99 qa := NewQualityAnalyzer(qm, nil)
100
101 memories := []MemoryWithScore{
102 {
103 DocID: "mem1",
104 Text: "The quick brown fox jumps over the lazy dog",
105 },
106 {
107 DocID: "mem2",
108 Text: "The quick brown fox jumps over the lazy dog",
109 },
110 {
111 DocID: "mem3",
112 Text: "Something completely different",
113 },
114 }
115
116 duplicates := qa.detectDuplicates(memories)
117
118 // 应该检测到 mem1 和 mem2 是重复的
119 if len(duplicates) == 0 {
120 t.Error("should detect duplicates")
121 }
122
123 // 验证重复信息
124 if duplicates[0].Type != InconsistencyDuplicate {
125 t.Errorf("type = %s, want %s", duplicates[0].Type, InconsistencyDuplicate)
126 }
127}
128
129func TestDetectOutdated(t *testing.T) {
130 config := DefaultQualityMetricsConfig()

Callers

nothing calls this directly

Calls 5

detectDuplicatesMethod · 0.95
NewQualityMetricsFunction · 0.85
NewQualityAnalyzerFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected