mirror of
https://github.com/golang/go
synced 2024-11-23 19:20:03 -07:00
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>
This commit is contained in:
parent
24e4cd9eb6
commit
a088f1b76c
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user