mirror of
https://github.com/godruoyi/go-snowflake.git
synced 2026-01-03 10:55:15 +00:00
🚛 first commit
This commit is contained in:
29
atomic_resolver_test.go
Normal file
29
atomic_resolver_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user