1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

rand: add rand.ulid() (#5979)

* removed debug println

* added newline to the end of the file

* time: add .unix_time_milli() method; rand,time: add tests

* rand: add more ulid tests; move tests to a separate file random_identifiers_test.v

* run vfmt over vlib/rand/random_identifiers_test.v

* speed up time.unix_time_milli

* simplify and speedup time.unix_time/0 and time.new_time/1

* update comment about rand.ulid()

* fix terminating 0 off by 1 issue in rand.ulid()

* optimize time.new_time()

* restore the master version of vlib/time/parse.v

* make test_unix_time more robust

Co-authored-by: Delyan Angelov <delian66@gmail.com>
This commit is contained in:
penguindark
2020-07-26 12:10:56 +02:00
committed by GitHub
parent 9e652c4f40
commit 7d52d612ce
5 changed files with 161 additions and 36 deletions

View File

@ -175,18 +175,3 @@ fn test_rand_f64_in_range() {
assert value < max
}
}
fn test_rand_uuid_v4() {
uuid1 := rand.uuid_v4()
uuid2 := rand.uuid_v4()
uuid3 := rand.uuid_v4()
assert uuid1 != uuid2
assert uuid1 != uuid3
assert uuid2 != uuid3
assert uuid1.len == 36
assert uuid2.len == 36
assert uuid3.len == 36
assert uuid1[14] == `4`
assert uuid2[14] == `4`
assert uuid3[14] == `4`
}