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

Function TestNegativeTimout

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

Source from the content-addressed store, hash-verified

17}
18
19func TestNegativeTimout(t *testing.T) {
20 // Timeout for -1 seconds.
21 start := time.Now()
22 timer := NewTimer(-1)
23 <-timer.C
24 if int(time.Since(start).Seconds()) != 0 {
25 t.Errorf("took ~%v seconds, should be ~0 seconds\n", int(time.Since(start).Seconds()))
26 }
27
28 // Timeout for -100 seconds.
29 start = time.Now()
30 timer = NewTimer(-100 * time.Second)
31 <-timer.C
32 if int(time.Since(start).Seconds()) != 0 {
33 t.Errorf("took ~%v seconds, should be ~0 seconds\n", int(time.Since(start).Seconds()))
34 }
35}
36
37func TestTimeValue(t *testing.T) {
38 // Timeout for 0 seconds.

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…