MCPcopy Index your code
hub / github.com/EngoEngine/engo / TestClockFPS

Function TestClockFPS

clock_test.go:34–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestClockFPS(t *testing.T) {
35 data := []struct {
36 fps int
37 }{
38 {5},
39 {10},
40 {20},
41 {30},
42 {60},
43 }
44 for _, d := range data {
45 theTimer = testTime{0}
46 clock := NewClock()
47 tickTime := 1000000000 / d.fps
48 curTime := int64(0)
49 for i := 0; i < d.fps; i++ {
50 curTime += int64(tickTime) + 1
51 theTimer = testTime{curTime}
52 clock.Tick()
53 }
54 if clock.FPS() != float32(d.fps) {
55 t.Errorf("Clock's FPS did not match %v fps, was %v", d.fps, clock.FPS())
56 }
57 }
58}
59
60func TestClockDelta(t *testing.T) {
61 data := []struct {

Callers

nothing calls this directly

Calls 3

TickMethod · 0.95
FPSMethod · 0.95
NewClockFunction · 0.85

Tested by

no test coverage detected