mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: apply stricter type checks to function args and return types
This commit is contained in:
@@ -84,7 +84,7 @@ pub fn (instance BitField) get_bit(bitnr int) int {
|
||||
if bitnr >= instance.size {
|
||||
return 0
|
||||
}
|
||||
return (instance.field[bitslot(bitnr)] >> (bitnr % slot_size)) & u32(1)
|
||||
return int((instance.field[bitslot(bitnr)] >> (bitnr % slot_size)) & u32(1))
|
||||
}
|
||||
|
||||
// set_bit sets bit number 'bit_nr' to 1 (count from 0).
|
||||
|
||||
@@ -19,7 +19,7 @@ fn test_bf_set_clear_toggle_get() {
|
||||
}
|
||||
|
||||
fn test_bf_and_not_or_xor() {
|
||||
rand.seed(time.now().unix)
|
||||
rand.seed(int(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().unix)
|
||||
rand.seed(int(time.now().unix))
|
||||
len := 80
|
||||
mut input := bitfield.new(len)
|
||||
for i in 0..len {
|
||||
@@ -60,7 +60,7 @@ fn test_clone_cmp() {
|
||||
}
|
||||
|
||||
fn test_slice_join() {
|
||||
rand.seed(time.now().unix)
|
||||
rand.seed(int(time.now().unix))
|
||||
len := 80
|
||||
mut input := bitfield.new(len)
|
||||
for i in 0..len {
|
||||
@@ -83,7 +83,7 @@ fn test_slice_join() {
|
||||
}
|
||||
|
||||
fn test_pop_count() {
|
||||
rand.seed(time.now().unix)
|
||||
rand.seed(int(time.now().unix))
|
||||
len := 80
|
||||
mut count0 := 0
|
||||
mut input := bitfield.new(len)
|
||||
@@ -98,7 +98,7 @@ fn test_pop_count() {
|
||||
}
|
||||
|
||||
fn test_hamming() {
|
||||
rand.seed(time.now().unix)
|
||||
rand.seed(int(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_str() {
|
||||
rand.seed(time.now().unix)
|
||||
rand.seed(int(time.now().unix))
|
||||
len := 80
|
||||
mut input := ''
|
||||
for _ in 0..len {
|
||||
@@ -160,7 +160,7 @@ fn test_bf_from_str() {
|
||||
}
|
||||
|
||||
fn test_bf_bf2str() {
|
||||
rand.seed(time.now().unix)
|
||||
rand.seed(int(time.now().unix))
|
||||
len := 80
|
||||
mut input := bitfield.new(len)
|
||||
for i in 0..len {
|
||||
@@ -188,7 +188,7 @@ fn test_bf_bf2str() {
|
||||
}
|
||||
|
||||
fn test_bf_set_all() {
|
||||
rand.seed(time.now().unix)
|
||||
rand.seed(int(time.now().unix))
|
||||
len := 80
|
||||
mut input := bitfield.new(len)
|
||||
input.set_all()
|
||||
@@ -202,7 +202,7 @@ fn test_bf_set_all() {
|
||||
}
|
||||
|
||||
fn test_bf_clear_all() {
|
||||
rand.seed(time.now().unix)
|
||||
rand.seed(int(time.now().unix))
|
||||
len := 80
|
||||
mut input := bitfield.new(len)
|
||||
for i in 0..len {
|
||||
@@ -221,7 +221,7 @@ fn test_bf_clear_all() {
|
||||
}
|
||||
|
||||
fn test_bf_reverse() {
|
||||
rand.seed(time.now().unix)
|
||||
rand.seed(int(time.now().unix))
|
||||
len := 80
|
||||
mut input := bitfield.new(len)
|
||||
for i in 0..len {
|
||||
@@ -241,7 +241,7 @@ fn test_bf_reverse() {
|
||||
}
|
||||
|
||||
fn test_bf_resize() {
|
||||
rand.seed(time.now().unix)
|
||||
rand.seed(int(time.now().unix))
|
||||
len := 80
|
||||
mut input := bitfield.new(rand.next(len) + 1)
|
||||
for _ in 0..100 {
|
||||
@@ -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().unix)
|
||||
rand.seed(int(time.now().unix))
|
||||
len := 80
|
||||
mut result := 1
|
||||
for i := 1; i < len; i++ { // needle size
|
||||
@@ -322,7 +322,7 @@ fn test_bf_rotate() {
|
||||
}
|
||||
|
||||
fn test_bf_printing(){
|
||||
rand.seed(time.now().unix)
|
||||
rand.seed(int(time.now().unix))
|
||||
len := 80
|
||||
mut input := bitfield.new(len)
|
||||
for i in 0..len {
|
||||
|
||||
Reference in New Issue
Block a user