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

Function TestMultipleZeroResets

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

Source from the content-addressed store, hash-verified

239}
240
241func TestMultipleZeroResets(t *testing.T) {
242 start := time.Now()
243 var timers []*Timer
244
245 for i := 0; i < 1000; i++ {
246 timer := NewTimer(time.Second)
247 timers = append(timers, timer)
248 timer.Reset(0)
249 }
250
251 // Wait for them all to expire.
252 for _, timer := range timers {
253 <-timer.C
254 }
255
256 if int(time.Since(start).Seconds()) != 0 {
257 t.Errorf("took ~%v seconds, should be ~0 seconds\n", int(time.Since(start).Seconds()))
258 }
259}
260
261func TestResetChannelClear(t *testing.T) {
262 timer := NewTimer(0)

Callers

nothing calls this directly

Calls 2

ResetMethod · 0.95
NewTimerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…