MCPcopy Index your code
hub / github.com/desertbit/timer / TestMultipleTimouts

Function TestMultipleTimouts

timer_test.go:57–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

55}
56
57func TestMultipleTimouts(t *testing.T) {
58 start := time.Now()
59 var timers []*Timer
60
61 for i := 0; i < 1000; i++ {
62 timers = append(timers, NewTimer(time.Second))
63 }
64
65 // Wait for them all to expire.
66 for _, timer := range timers {
67 <-timer.C
68 }
69
70 if int(time.Since(start).Seconds()) != 1 {
71 t.Errorf("took ~%v seconds, should be ~1 seconds\n", int(time.Since(start).Seconds()))
72 }
73}
74
75func TestMultipleDifferentTimouts(t *testing.T) {
76 start := time.Now()

Callers

nothing calls this directly

Calls 1

NewTimerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…