[]: update all examples and tests

pull/2760/head
Alexander Medvednikov 2019-11-14 10:00:22 +03:00
parent 96b530cf85
commit 7d924679a6
10 changed files with 390 additions and 389 deletions

View File

@ -174,7 +174,7 @@ fn (g mut Game) init_game() {
g.parse_tetros()
rand.seed(time.now().uni)
g.generate_tetro()
g.field = []array_int // TODO: g.field = [][]int
g.field = [] // TODO: g.field = [][]int
// Generate the field, fill it with 0's, add -1's on each edge
for i := 0; i < FieldHeight + 2; i++ {
mut row := [0].repeat(FieldWidth + 2)

View File

@ -143,7 +143,7 @@ pub fn run_repl() []string {
os.write_file(file, source_code)
s := os.exec('"$vexe" run $file -repl') or {
rerror(err)
return []string
return []
}
print_output(s)
}
@ -160,7 +160,7 @@ pub fn run_repl() []string {
s := os.exec('"$vexe" run $temp_file -repl') or {
println("SDFSDF")
rerror(err)
return []string
return []
}
if !func_call && s.exit_code == 0 && !temp_flag {
for r.temp_lines.len > 0 {

View File

@ -65,7 +65,7 @@ struct K {
}
fn test_empty() {
mut chunks := []
mut chunks := []Chunk
a := Chunk{}
assert chunks.len == 0
chunks << a
@ -346,7 +346,7 @@ fn (t Test) str() string {
fn test_struct_print() {
mut a := Test {
a: 'Test',
b: []Test2
b: []
}
b := Test2 {
one: 1,

View File

@ -70,7 +70,7 @@ pub fn (x mut AesCbc) encrypt_blocks(dst mut []byte, src_ []byte) {
// Move to the next block with this block as the next iv.
iv = dst[..x.block_size]
if x.block_size >= src.len {
src = []byte
src = []
} else {
src = src[x.block_size..]
}

View File

@ -109,7 +109,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
h4 += e
if chunk >= p.len {
p = []byte
p = []
} else {
p = p[chunk..]
}

View File

@ -104,7 +104,7 @@ fn (d mut Digest) write(p_ []byte) int {
d.nx = 0
}
if n >= p.len {
p = []byte
p = []
} else {
p = p[n..]
}
@ -113,7 +113,7 @@ fn (d mut Digest) write(p_ []byte) int {
n := p.len &~ (chunk - 1)
block(mut d, p[..n])
if n >= p.len {
p = []byte
p = []
} else {
p = p[n..]
}

View File

@ -5,5 +5,6 @@
import crypto.sha256
fn test_crypto_sha256() {
assert sha256.sum('This is a sha256 checksum.'.bytes()).hex() == 'dc7163299659529eae29683eb1ffec50d6c8fc7275ecb10c145fde0e125b8727'
assert sha256.sum('This is a sha256 checksum.'.bytes()).hex() ==
'dc7163299659529eae29683eb1ffec50d6c8fc7275ecb10c145fde0e125b8727'
}

View File

@ -142,7 +142,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
h7 += h
if chunk >= p.len {
p = []byte
p = []
} else {
p = p[chunk..]
}

View File

@ -158,7 +158,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
h7 += h
if Chunk >= p.len {
p = []byte
p = []
} else {
p = p[Chunk..]
}

View File

@ -144,7 +144,7 @@ fn test_finalize_returns_error_for_unknown_flags() {
}
fn test_allow_to_build_usage_message() {
mut fp := flag.new_flag_parser([]string)
mut fp := flag.new_flag_parser([])
fp.limit_free_args(1, 4)
fp.application('flag_tool')
fp.version('v0.0.0')
@ -177,7 +177,7 @@ fn test_allow_to_build_usage_message() {
}
fn test_if_no_description_given_usage_message_does_not_contain_descpription() {
mut fp := flag.new_flag_parser([]string)
mut fp := flag.new_flag_parser([])
fp.application('flag_tool')
fp.version('v0.0.0')
@ -187,7 +187,7 @@ fn test_if_no_description_given_usage_message_does_not_contain_descpription() {
}
fn test_if_no_options_given_usage_message_does_not_contain_options() {
mut fp := flag.new_flag_parser([]string)
mut fp := flag.new_flag_parser([])
fp.application('flag_tool')
fp.version('v0.0.0')