add uuid functions
This commit is contained in:
29
uuid_test.go
Normal file
29
uuid_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package rand_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"git.sunturtle.xyz/zephyr/rand"
|
||||
)
|
||||
|
||||
func TestUUIDv4(t *testing.T) {
|
||||
u, err := uuid.Parse(rand.UUIDv4())
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if u.Version() != 4 {
|
||||
t.Errorf("wrong version: want 4, got %d", u.Version())
|
||||
}
|
||||
}
|
||||
|
||||
func TestUUIDv7(t *testing.T) {
|
||||
u, err := uuid.Parse(rand.UUIDv7())
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if u.Version() != 7 {
|
||||
t.Errorf("wrong version: want 7, got %d", u.Version())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user