feat(ai-sdk): Advisor Reasoning Stack — Clarity+G1+Concept-Injector+Context-Scope+Term-Resolution+E4-Curation+Intent-Signal
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package ucca
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestConceptNorms(t *testing.T) {
|
||||
q := "Was muss ich beachten wenn ich meine Datenschutzerklärung schreibe für meine Website mit Cookie Banner?"
|
||||
got := ConceptNorms(q)
|
||||
want := map[string]bool{
|
||||
"EU-DSGVO-Art12": true, "EU-DSGVO-Art13": true, "EU-DSGVO-Art14": true,
|
||||
"DE-TDDDG-§25": true, "EU-DSGVO-Art6": true, "EU-DSGVO-Art7": true,
|
||||
}
|
||||
for _, nid := range got {
|
||||
delete(want, nid)
|
||||
}
|
||||
if len(want) > 0 {
|
||||
t.Errorf("ConceptNorms missing %v; got %v", want, got)
|
||||
}
|
||||
if len(ConceptNorms("Wie ist das Wetter heute?")) != 0 {
|
||||
t.Errorf("no concept named should yield no norms")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInjectConceptNorms(t *testing.T) {
|
||||
results := []LegalSearchResult{
|
||||
{CitationUnit: "DSK OH Telemedien", Score: 0.98},
|
||||
{CitationUnit: "Art. 25 DSGVO", Score: 0.95},
|
||||
}
|
||||
injected := []LegalSearchResult{
|
||||
{CitationUnit: "Art. 13 DSGVO", Score: 0.979},
|
||||
{CitationUnit: "Art. 25 DSGVO", Score: 0.979}, // already present -> must not double
|
||||
}
|
||||
out := InjectConceptNorms(results, injected, 10)
|
||||
if out[0].CitationUnit != "DSK OH Telemedien" {
|
||||
t.Errorf("top document hit must stay #1 (not dominated), got %s", out[0].CitationUnit)
|
||||
}
|
||||
if len(out) != 3 {
|
||||
t.Errorf("expected 3 (Art.25 not duplicated), got %d", len(out))
|
||||
}
|
||||
found := false
|
||||
for _, r := range out {
|
||||
if r.CitationUnit == "Art. 13 DSGVO" {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Errorf("Art. 13 DSGVO must be injected + visible")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user