aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/hash_test.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2015-08-24 21:10:36 -0700
committerKeith Randall <khr@golang.org>2015-08-31 19:38:24 +0000
commita088f1b76ccb931eb72e4ef54c1f59053996478c (patch)
treea285ed14fa2edda2cb1283873db3f442bc4ac5dd /src/runtime/hash_test.go
parent24e4cd9eb6357105027a4c580a311e84b00273ba (diff)
downloadgo-a088f1b76ccb931eb72e4ef54c1f59053996478c.tar.gz
go-a088f1b76ccb931eb72e4ef54c1f59053996478c.zip
runtime: soften up hash checks a bit
The hash tests generate occasional failures, quiet them some more. In particular we can get 1 collision when the expected number is .001 or so. That shouldn't be a dealbreaker. Fixes #12311 Change-Id: I784e91b5d21f4f1f166dc51bde2d1cd3a7a3bfea Reviewed-on: https://go-review.googlesource.com/13902 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'src/runtime/hash_test.go')
-rw-r--r--src/runtime/hash_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/hash_test.go b/src/runtime/hash_test.go
index 6b229bdb88..579b0e3e67 100644
--- a/src/runtime/hash_test.go
+++ b/src/runtime/hash_test.go
@@ -74,7 +74,7 @@ func (s *HashSet) check(t *testing.T) {
pairs := int64(s.n) * int64(s.n-1) / 2
expected := float64(pairs) / math.Pow(2.0, float64(hashSize))
stddev := math.Sqrt(expected)
- if float64(collisions) > expected+SLOP*3*stddev {
+ if float64(collisions) > expected+SLOP*(3*stddev+1) {
t.Errorf("unexpected number of collisions: got=%d mean=%f stddev=%f", collisions, expected, stddev)
}
}