package indexer import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zzet/gortex/internal/clones" "github.com/zzet/gortex/internal/graph" ) // semanticallyRelatedEdges collects every EdgeSemanticallyRelated edge // in the graph — the diffusion-pass output surface. func semanticallyRelatedEdges(g graph.Store) []*graph.Edge { var out []*graph.Edge for _, e := range g.AllEdges() { if e.Kind == graph.EdgeSemanticallyRelated { out = append(out, e) } } return out } // addFnNode registers a bare function node so diffuseSimilarityEdges // has real endpoints to attach edges to. func addFnNode(g graph.Store, id string) { g.AddNode(&graph.Node{ ID: id, Kind: graph.KindFunction, Name: id, FilePath: id, StartLine: 1, Language: "go", }) } // TestDiffuseSimilarityEdges_Chain is the core table-driven test for // the graph-diffusion smoothing pass. Each case feeds a set of direct // clone pairs (the EdgeSimilarTo seed graph) plus the set already // emitted as direct clones, then asserts which semantically_related // pairs the diffusion pass derives. func TestDiffuseSimilarityEdges_Chain(t *testing.T) { cases := []struct { name string // direct similarity pairs feeding the diffusion graph. pairs []clones.Pair // canonicalised pairs already emitted as direct clones. directClones [][2]string // canonicalised (A