MCPcopy Create free account
hub / github.com/EngoEngine/ecs / TestRemoveChild

Function TestRemoveChild

entity_test.go:404–422  ·  view source on GitHub ↗

TestRemoveChild tests removing a child

(t *testing.T)

Source from the content-addressed store, hash-verified

402
403// TestRemoveChild tests removing a child
404func TestRemoveChild(t *testing.T) {
405 parent := NewBasic()
406 children := NewBasics(3)
407 parent.AppendChild(&children[0])
408 parent.AppendChild(&children[1])
409 parent.AppendChild(&children[2])
410 if len(parent.Children()) != 3 {
411 t.Errorf("Parent did not successfully add all three children.")
412 }
413 parent.RemoveChild(&children[1])
414 if len(parent.Children()) != 2 {
415 t.Errorf("Parent didd not successfully remove a child")
416 }
417 for i := 0; i < 2; i++ {
418 if children[1].ID() == parent.Children()[i].ID() {
419 t.Errorf("Found removed child in parent still")
420 }
421 }
422}
423
424func TestDescendents(t *testing.T) {
425 parent := NewBasic()

Callers

nothing calls this directly

Calls 6

NewBasicFunction · 0.85
NewBasicsFunction · 0.85
AppendChildMethod · 0.80
ChildrenMethod · 0.80
RemoveChildMethod · 0.80
IDMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…