mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-10 10:36:42 -05:00
* added command line arg for launching ecs impl * removed render system tests, was causing gl context issues in tests * fixed all lint errors in d2systems
44 lines
767 B
Go
44 lines
767 B
Go
package d2systems
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/gravestench/akara"
|
|
)
|
|
|
|
func TestTimeScaleSystem_Init(t *testing.T) {
|
|
cfg := akara.NewWorldConfig()
|
|
|
|
cfg.With(NewTimeScaleSystem())
|
|
|
|
world := akara.NewWorld(cfg)
|
|
|
|
if len(world.Systems) != 1 {
|
|
t.Error("system not added to the world")
|
|
}
|
|
}
|
|
|
|
func TestTimeScaleSystem_Process(t *testing.T) {
|
|
cfg := akara.NewWorldConfig()
|
|
|
|
timescaleSystem := NewTimeScaleSystem()
|
|
|
|
cfg.With(timescaleSystem)
|
|
|
|
timescaleSystem.scale = 0.01
|
|
|
|
world := akara.NewWorld(cfg)
|
|
|
|
actual := time.Second
|
|
expected := time.Duration(timescaleSystem.scale) * actual
|
|
|
|
if err := world.Update(actual); err != nil {
|
|
timescaleSystem.Error(err.Error())
|
|
}
|
|
|
|
if world.TimeDelta != expected {
|
|
t.Error("world time delta not scaled")
|
|
}
|
|
}
|