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

time: rewrite unix() function

This commit is contained in:
lutherwenxu
2020-01-01 00:11:47 +08:00
committed by Alexander Medvednikov
parent 67912c692b
commit 286a0a1371
8 changed files with 186 additions and 109 deletions

View File

@@ -19,7 +19,7 @@ fn test_bf_set_clear_toggle_get() {
}
fn test_bf_and_not_or_xor() {
rand.seed(time.now().uni)
rand.seed(time.now().unix)
len := 80
mut input1 := bitfield.new(len)
mut input2 := bitfield.new(len)
@@ -46,7 +46,7 @@ fn test_bf_and_not_or_xor() {
}
fn test_clone_cmp() {
rand.seed(time.now().uni)
rand.seed(time.now().unix)
len := 80
mut input := bitfield.new(len)
for i := 0; i < len; i++ {
@@ -60,7 +60,7 @@ fn test_clone_cmp() {
}
fn test_slice_join() {
rand.seed(time.now().uni)
rand.seed(time.now().unix)
len := 80
mut input := bitfield.new(len)
for i := 0; i < len; i++ {
@@ -83,7 +83,7 @@ fn test_slice_join() {
}
fn test_popcount() {
rand.seed(time.now().uni)
rand.seed(time.now().unix)
len := 80
mut count0 := 0
mut input := bitfield.new(len)
@@ -98,7 +98,7 @@ fn test_popcount() {
}
fn test_hamming() {
rand.seed(time.now().uni)
rand.seed(time.now().unix)
len := 80
mut count := 0
mut input1 := bitfield.new(len)
@@ -138,7 +138,7 @@ fn test_bf_from_bytes() {
}
fn test_bf_from_string() {
rand.seed(time.now().uni)
rand.seed(time.now().unix)
len := 80
mut input := ''
for i := 0; i < len; i++ {
@@ -160,7 +160,7 @@ fn test_bf_from_string() {
}
fn test_bf_bf2str() {
rand.seed(time.now().uni)
rand.seed(time.now().unix)
len := 80
mut input := bitfield.new(len)
for i := 0; i < len; i++ {
@@ -188,7 +188,7 @@ fn test_bf_bf2str() {
}
fn test_bf_setall() {
rand.seed(time.now().uni)
rand.seed(time.now().unix)
len := 80
mut input := bitfield.new(len)
input.setall()
@@ -202,7 +202,7 @@ fn test_bf_setall() {
}
fn test_bf_clearall() {
rand.seed(time.now().uni)
rand.seed(time.now().unix)
len := 80
mut input := bitfield.new(len)
for i := 0; i < len; i++ {
@@ -221,7 +221,7 @@ fn test_bf_clearall() {
}
fn test_bf_reverse() {
rand.seed(time.now().uni)
rand.seed(time.now().unix)
len := 80
mut input := bitfield.new(len)
for i := 0; i < len; i++ {
@@ -241,7 +241,7 @@ fn test_bf_reverse() {
}
fn test_bf_resize() {
rand.seed(time.now().uni)
rand.seed(time.now().unix)
len := 80
mut input := bitfield.new(rand.next(len) + 1)
for i := 0; i < 100; i++ {
@@ -259,7 +259,7 @@ fn test_bf_pos() {
* all haystacks here contain exactly one instanse of needle,
* so search should return non-negative-values
**/
rand.seed(time.now().uni)
rand.seed(time.now().unix)
len := 80
mut result := 1
for i := 1; i < len; i++ { // needle size