1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-11 00:02:28 +08:00

feat: add func UUIdV4

This commit is contained in:
dudaodong
2022-02-20 10:16:15 +08:00
parent 96d57a6d24
commit a19a861552
2 changed files with 29 additions and 0 deletions

View File

@@ -47,3 +47,16 @@ func TestRandBytes(t *testing.T) {
assert.Equal([]byte{}, RandBytes(0))
}
func TestUUIdV4(t *testing.T) {
assert := internal.NewAssert(t, "TestUUIdV4")
uuid, err := UUIdV4()
if err != nil {
t.Log(err)
t.Fail()
}
isUUiDV4 := regexp.MustCompile(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$`)
assert.Equal(true, isUUiDV4.MatchString(uuid))
}