add uuid functions

This commit is contained in:
2025-11-21 10:29:40 -05:00
parent 193abbd2ce
commit 8b2ca71f6b
4 changed files with 50 additions and 0 deletions

29
uuid_test.go Normal file
View 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())
}
}