| 239 | } |
| 240 | |
| 241 | func 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 | |
| 261 | func TestResetChannelClear(t *testing.T) { |
| 262 | timer := NewTimer(0) |