x/snowflake/snowflake_test.go

25 lines
372 B
Go
Raw Normal View History

2020-06-12 04:26:57 +00:00
package snowflake
import (
"fmt"
"testing"
)
func TestNext(t *testing.T) {
fmt.Printf("node id: %b\n", generateNodeID())
fmt.Printf("timestamp: %b\n", ts())
fmt.Printf("full token: %b\n", Next())
}
func BenchmarkNext(b *testing.B) {
for n := 0; n < b.N; n++ {
Next()
}
}
func BenchmarkNextParallel(b *testing.B) {
for n := 0; n < b.N; n++ {
go Next()
}
}