mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
rand: fix rand.uuid_v4()'s clock_seq_hi_and_reserved field
This commit is contained in:
@ -12,9 +12,13 @@ fn test_rand_uuid_v4() {
|
||||
assert uuid1.len == 36
|
||||
assert uuid2.len == 36
|
||||
assert uuid3.len == 36
|
||||
assert uuid1[14] == `4`
|
||||
assert uuid2[14] == `4`
|
||||
assert uuid3[14] == `4`
|
||||
for i in 0 .. 1000 {
|
||||
x := rand.uuid_v4()
|
||||
// check the version field is always 4:
|
||||
assert x[14] == `4`
|
||||
// and the clock_seq_hi_and_reserved field is valid too:
|
||||
assert x[19] in [`8`, `9`, `a`, `b`]
|
||||
}
|
||||
}
|
||||
|
||||
// ulids:
|
||||
|
Reference in New Issue
Block a user