diff options
Diffstat (limited to 'src/pkg/time/tick_test.go')
| -rw-r--r-- | src/pkg/time/tick_test.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pkg/time/tick_test.go b/src/pkg/time/tick_test.go index 4a82eee74..a672ee469 100644 --- a/src/pkg/time/tick_test.go +++ b/src/pkg/time/tick_test.go @@ -5,15 +5,15 @@ package time_test import ( - "testing"; - . "time"; + "testing"; + . "time"; ) func TestTicker(t *testing.T) { const ( - Delta = 100*1e6; - Count = 10; - ); + Delta = 100*1e6; + Count = 10; + ) ticker := NewTicker(Delta); t0 := Nanoseconds(); for i := 0; i < Count; i++ { @@ -21,10 +21,10 @@ func TestTicker(t *testing.T) { } ticker.Stop(); t1 := Nanoseconds(); - ns := t1 - t0; + ns := t1-t0; target := int64(Delta*Count); slop := target*2/10; - if ns < target - slop || ns > target + slop { + if ns < target-slop || ns > target+slop { t.Fatalf("%d ticks of %g ns took %g ns, expected %g", Count, float64(Delta), float64(ns), float64(target)); } // Now test that the ticker stopped |
