TestSystemEntityFiltering checks that entities go into the right systems and the flags are obeyed
(t *testing.T)
| 265 | |
| 266 | // TestSystemEntityFiltering checks that entities go into the right systems and the flags are obeyed |
| 267 | func TestSystemEntityFiltering(t *testing.T) { |
| 268 | w := &World{} |
| 269 | |
| 270 | var sys1in *MySystemOneable |
| 271 | w.AddSystemInterface(&MySystemOne{}, sys1in, nil) |
| 272 | |
| 273 | var sys2in *MySystemTwoable |
| 274 | var sys2out *NotMySystemTwoable |
| 275 | w.AddSystemInterface(&MySystemTwo{}, sys2in, sys2out) |
| 276 | |
| 277 | var sys12in *MySystemOneTwoable |
| 278 | var sys12out *NotMySystemOneTwoable |
| 279 | w.AddSystemInterface(&MySystemOneTwo{}, sys12in, sys12out) |
| 280 | |
| 281 | e1 := struct { |
| 282 | BasicEntity |
| 283 | *MyComponent1 |
| 284 | }{ |
| 285 | NewBasic(), |
| 286 | &MyComponent1{}, |
| 287 | } |
| 288 | w.AddEntity(&e1) |
| 289 | |
| 290 | e2 := struct { |
| 291 | BasicEntity |
| 292 | *MyComponent2 |
| 293 | }{ |
| 294 | NewBasic(), |
| 295 | &MyComponent2{}, |
| 296 | } |
| 297 | w.AddEntity(&e2) |
| 298 | |
| 299 | e12 := struct { |
| 300 | BasicEntity |
| 301 | *MyComponent1 |
| 302 | *MyComponent2 |
| 303 | }{ |
| 304 | NewBasic(), |
| 305 | &MyComponent1{}, |
| 306 | &MyComponent2{}, |
| 307 | } |
| 308 | w.AddEntity(&e12) |
| 309 | |
| 310 | e12x2 := struct { |
| 311 | BasicEntity |
| 312 | *MyComponent1 |
| 313 | *MyComponent2 |
| 314 | *NotMyComponent2 |
| 315 | }{ |
| 316 | NewBasic(), |
| 317 | &MyComponent1{}, |
| 318 | &MyComponent2{}, |
| 319 | &NotMyComponent2{}, |
| 320 | } |
| 321 | w.AddEntity(&e12x2) |
| 322 | |
| 323 | e12x12 := struct { |
| 324 | BasicEntity |
nothing calls this directly
no test coverage detected
searching dependent graphs…