TestAddRemove tests adding and removing entities in systems that don't implement SystemAddByInterfacer to the world.
(t *testing.T)
| 98 | // TestAddRemove tests adding and removing entities in systems that don't implement |
| 99 | // SystemAddByInterfacer to the world. |
| 100 | func TestAddRemove(t *testing.T) { |
| 101 | w := &World{} |
| 102 | sys := SystemAddRemove{} |
| 103 | w.AddSystem(&sys) |
| 104 | ent := struct { |
| 105 | BasicEntity |
| 106 | PriorityComponent |
| 107 | }{ |
| 108 | BasicEntity: NewBasic(), |
| 109 | } |
| 110 | w.AddEntity(ent) |
| 111 | if len(sys.entities) != 0 { |
| 112 | t.Error("Entity was added even though the system does not implement SystemAddByInterfacer") |
| 113 | } |
| 114 | sys.Add(ent.BasicEntity, &ent.PriorityComponent) |
| 115 | if len(sys.entities) != 1 { |
| 116 | t.Error("Failed to add entity to system") |
| 117 | } |
| 118 | w.RemoveEntity(ent.BasicEntity) |
| 119 | if len(sys.entities) != 0 { |
| 120 | t.Error("Removing the entity from the world did not remove it from the system.") |
| 121 | } |
| 122 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…