Skip to content

Commit d800ff7

Browse files
committed
Fix Test
1 parent f0cd3db commit d800ff7

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

hash/hashutil/bloom/bloomf_test.go

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"testing"
55
)
66

7-
func Test(t *testing.T) {
8-
t.Run("Bloom", func(t *testing.T) {
7+
func TestBloom(t *testing.T) {
8+
t.Run("bloom-3", func(t *testing.T) {
99
var list = []string{
1010
"apple",
1111
"banana",
@@ -23,3 +23,25 @@ func Test(t *testing.T) {
2323
}
2424
})
2525
}
26+
27+
func BenchmarkBloom(b *testing.B) {
28+
var list = []string{
29+
"apple",
30+
"banana",
31+
"cherry",
32+
"golang",
33+
"python",
34+
"ruby",
35+
"rust",
36+
"java",
37+
}
38+
bf := NewBloom(uint64(len(list)), 0.01)
39+
for _, s := range list {
40+
bf.SetString(s)
41+
}
42+
43+
b.ResetTimer()
44+
for i := 0; i < b.N; i++ {
45+
bf.GetString("apple")
46+
}
47+
}

0 commit comments

Comments
 (0)