libgo: Update to weekly.2011-12-02.

From-SVN: r182295
This commit is contained in:
Ian Lance Taylor 2011-12-13 19:16:27 +00:00
parent 36cfbee133
commit 7b1c3dd9e6
234 changed files with 6653 additions and 4704 deletions

View file

@ -11,21 +11,21 @@ import (
func TestTicker(t *testing.T) {
const (
Delta = 100 * 1e6
Delta = 100 * Millisecond
Count = 10
)
ticker := NewTicker(Delta)
t0 := Nanoseconds()
t0 := Now()
for i := 0; i < Count; i++ {
<-ticker.C
}
ticker.Stop()
t1 := Nanoseconds()
ns := t1 - t0
target := int64(Delta * Count)
t1 := Now()
dt := t1.Sub(t0)
target := Delta * Count
slop := target * 2 / 10
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))
if dt < target-slop || dt > target+slop {
t.Fatalf("%d %s ticks took %s, expected [%s,%s]", Count, Delta, dt, target-slop, target+slop)
}
// Now test that the ticker stopped
Sleep(2 * Delta)