Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(958)

Delta Between Two Patch Sets: src/pkg/time/sleep_test.go

Issue 4631098: code review 4631098: sort: rename helpers: s/Sort// in sort.Sort[Float64s|In... (Closed)
Left Patch Set: Created 13 years, 8 months ago
Right Patch Set: diff -r e276ba524959 https://go.googlecode.com/hg/ Created 13 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/sort/sort_test.go ('k') | src/pkg/unicode/maketables.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package time_test 5 package time_test
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "os" 9 "os"
10 "syscall" 10 "syscall"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 ) 165 )
166 // make the result channel buffered because we don't want 166 // make the result channel buffered because we don't want
167 // to depend on channel queueing semantics that might 167 // to depend on channel queueing semantics that might
168 // possibly change in the future. 168 // possibly change in the future.
169 result := make(chan afterResult, len(slots)) 169 result := make(chan afterResult, len(slots))
170 170
171 t0 := Nanoseconds() 171 t0 := Nanoseconds()
172 for _, slot := range slots { 172 for _, slot := range slots {
173 go await(slot, result, After(int64(slot)*Delta)) 173 go await(slot, result, After(int64(slot)*Delta))
174 } 174 }
175 » sort.SortInts(slots) 175 » sort.Ints(slots)
176 for _, slot := range slots { 176 for _, slot := range slots {
177 r := <-result 177 r := <-result
178 if r.slot != slot { 178 if r.slot != slot {
179 return fmt.Errorf("after queue got slot %d, expected %d" , r.slot, slot) 179 return fmt.Errorf("after queue got slot %d, expected %d" , r.slot, slot)
180 } 180 }
181 ns := r.t - t0 181 ns := r.t - t0
182 target := int64(slot * Delta) 182 target := int64(slot * Delta)
183 slop := int64(Delta) / 4 183 slop := int64(Delta) / 4
184 if ns < target-slop || ns > target+slop { 184 if ns < target-slop || ns > target+slop {
185 return fmt.Errorf("after queue slot %d arrived at %g, ex pected [%g,%g]", slot, float64(ns), float64(target-slop), float64(target+slop)) 185 return fmt.Errorf("after queue slot %d arrived at %g, ex pected [%g,%g]", slot, float64(ns), float64(target-slop), float64(target+slop))
186 } 186 }
187 } 187 }
188 return nil 188 return nil
189 } 189 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b