Files
go-snowflake/atomic_resolver_test.go
2021-04-15 11:50:51 +08:00

30 lines
493 B
Go

package snowflake_test
import (
"testing"
"github.com/godruoyi/go-snowflake"
)
func TestAtomicResolver(t *testing.T) {
id, _ := snowflake.AtomicResolver(1)
if id != 0 {
t.Error("Sequence should be equal 0")
}
}
func BenchmarkCombinationParallel(b *testing.B) {
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
_, _ = snowflake.AtomicResolver(1)
}
})
}
func BenchmarkAtomicResolver(b *testing.B) {
for i := 0; i < b.N; i++ {
_, _ = snowflake.AtomicResolver(1)
}
}