package rag import ( "context" "testing" ) func TestHashEmbedderStable(t *testing.T) { a, err := HashEmbedder{}.Embed(context.Background(), []string{"需求追溯"}) if err != nil { t.Fatal(err) } b, _ := HashEmbedder{}.Embed(context.Background(), []string{"需求追溯"}) if len(a) != 1 || len(a[0]) != hashDim { t.Fatalf("dim: %d", len(a[0])) } for i := range a[0] { if a[0][i] != b[0][i] { t.Fatal("hash embedder must be stable") } } }