Files
EdgeNode/internal/utils/fnv/hash_test.go

25 lines
509 B
Go
Raw Normal View History

2022-03-15 18:32:39 +08:00
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package fnv_test
import (
"github.com/TeaOSLab/EdgeNode/internal/utils/fnv"
"github.com/iwind/TeaGo/types"
"testing"
)
func TestHash(t *testing.T) {
for _, key := range []string{"costarring", "liquid", "hello"} {
2022-03-16 17:06:26 +08:00
var h = fnv.HashString(key)
2022-03-15 18:32:39 +08:00
t.Log(key + " => " + types.String(h))
}
}
2023-08-15 20:12:09 +08:00
func BenchmarkHashString(b *testing.B) {
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
2024-04-15 08:42:33 +08:00
_ = fnv.HashString("abcdefh")
2023-08-15 20:12:09 +08:00
}
})
2024-04-15 08:42:33 +08:00
}