MCPcopy Create free account
hub / github.com/cogentcore/core / TestNodeFindName

Function TestNodeFindName

tree/node_test.go:107–121  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

105}
106
107func TestNodeFindName(t *testing.T) {
108 names := []string{"name0", "name1", "name2", "name3", "name4", "name5"}
109 parent := NewNodeBase()
110 for _, name := range names {
111 child := NewNodeBase(parent)
112 child.SetName(name)
113 }
114 assert.Len(t, parent.Children, len(names))
115 for i, nm := range names {
116 for st := range names { // test all starting indexes
117 idx := IndexByName(parent.Children, nm, st)
118 assert.Equal(t, i, idx)
119 }
120 }
121}
122
123func TestNodeFindType(t *testing.T) {
124 parent := NewNodeBase()

Callers

nothing calls this directly

Calls 5

SetNameMethod · 0.95
IndexByNameFunction · 0.85
EqualMethod · 0.80
NewNodeBaseFunction · 0.70
LenMethod · 0.65

Tested by

no test coverage detected