aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/runtime/hash_test.go
diff options
context:
space:
mode:
authorGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-22 17:43:43 -0300
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-22 17:43:43 -0300
commita926878ddbd5a98b272c22171ce58663fc04c3e0 (patch)
tree86af256e5d9a9c06263c00adc90e5fe348008c43 /libgo/go/runtime/hash_test.go
parent542730f087133690b47e036dfd43eb0db8a650ce (diff)
parent07cbaed8ba7d1b6e4ab3a9f44175502a4e1ecdb1 (diff)
downloadgcc-devel/autopar_devel.zip
gcc-devel/autopar_devel.tar.gz
gcc-devel/autopar_devel.tar.bz2
Merge branch 'autopar_rebase2' into autopar_develdevel/autopar_devel
Quickly commit changes in the rebase branch.
Diffstat (limited to 'libgo/go/runtime/hash_test.go')
-rw-r--r--libgo/go/runtime/hash_test.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/libgo/go/runtime/hash_test.go b/libgo/go/runtime/hash_test.go
index 522b7fe..60a8601 100644
--- a/libgo/go/runtime/hash_test.go
+++ b/libgo/go/runtime/hash_test.go
@@ -152,14 +152,13 @@ func (s *HashSet) addS_seed(x string, seed uintptr) {
s.add(StringHash(x, seed))
}
func (s *HashSet) check(t *testing.T) {
- const SLOP = 10.0
+ const SLOP = 50.0
collisions := s.n - len(s.m)
- //fmt.Printf("%d/%d\n", len(s.m), s.n)
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+1) {
- t.Errorf("unexpected number of collisions: got=%d mean=%f stddev=%f", collisions, expected, stddev)
+ t.Errorf("unexpected number of collisions: got=%d mean=%f stddev=%f threshold=%f", collisions, expected, stddev, expected+SLOP*(3*stddev+1))
}
}
@@ -564,8 +563,11 @@ func avalancheTest1(t *testing.T, k Key) {
// All bit rotations of a set of distinct keys
func TestSmhasherWindowed(t *testing.T) {
+ t.Logf("32 bit keys")
windowed(t, &Int32Key{})
+ t.Logf("64 bit keys")
windowed(t, &Int64Key{})
+ t.Logf("string keys")
windowed(t, &BytesKey{make([]byte, 128)})
}
func windowed(t *testing.T, k Key) {