x/snowflake/snowflake_test.go
Colin Henry 7154029136 linted
2023-04-05 21:20:45 -07:00

25 lines
372 B
Go
Executable File

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()
}
}