(t *testing.T)
| 106 | func (s *priorityChangeSystem) Update(dt float32) {} |
| 107 | |
| 108 | func TestWorld_SortSystems(t *testing.T) { |
| 109 | w := new(World) |
| 110 | one := priorityChangeSystem{Rank: 1} |
| 111 | w.AddSystem(&one) |
| 112 | two := priorityChangeSystem{Rank: 2} |
| 113 | w.AddSystem(&two) |
| 114 | expected := []System{ |
| 115 | &two, |
| 116 | &one, |
| 117 | } |
| 118 | for idx, sys := range w.Systems() { |
| 119 | p := sys.(Prioritizer) |
| 120 | exp := expected[idx].(Prioritizer) |
| 121 | if p.Priority() != exp.Priority() { |
| 122 | t.Error("Systems were not in the correct order") |
| 123 | } |
| 124 | } |
| 125 | one.Rank = 5 |
| 126 | for idx, sys := range w.Systems() { |
| 127 | p := sys.(Prioritizer) |
| 128 | exp := expected[idx].(Prioritizer) |
| 129 | if p.Priority() != exp.Priority() { |
| 130 | t.Error("Systems were switched before sort wwas called") |
| 131 | } |
| 132 | } |
| 133 | w.SortSystems() |
| 134 | for idx, sys := range w.Systems() { |
| 135 | p := sys.(Prioritizer) |
| 136 | exp := expected[len(expected)-1-idx].(Prioritizer) |
| 137 | if p.Priority() != exp.Priority() { |
| 138 | t.Error("Systems were switched before sort wwas called") |
| 139 | } |
| 140 | } |
| 141 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…