tests: use u8 everywhere
parent
80b35fe0c6
commit
de310491bb
|
@ -17,7 +17,7 @@ fn frame(mut ctx gg.Context) {
|
|||
ctx.begin()
|
||||
id := ctx.new_streaming_image(ctx.width, ctx.height, 4, pixel_format: .rgba8)
|
||||
mut img := ctx.get_cached_image_by_idx(id)
|
||||
mut bytes := []byte{len: img.width * img.height * 4, cap: img.width * img.height * 4}
|
||||
mut bytes := []u8{len: img.width * img.height * 4, cap: img.width * img.height * 4}
|
||||
for y in 0 .. img.height {
|
||||
for x in 0 .. img.width {
|
||||
unsafe {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fn main() {
|
||||
mut bc := []byte{}
|
||||
mut bc := []u8{}
|
||||
bc << [0xCA, 0xFE, 0xBA, 0xBE]
|
||||
println(bc)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
fn C.no() // untyped
|
||||
fn C.y1(int)
|
||||
fn C.ret()byte
|
||||
fn C.ret() u8
|
||||
|
||||
fn main() {
|
||||
C.no(1) // allowed
|
||||
|
@ -16,4 +16,4 @@ fn main() {
|
|||
}
|
||||
|
||||
[trusted]
|
||||
fn C.af()int
|
||||
fn C.af() int
|
||||
|
|
|
@ -26,7 +26,7 @@ fn main() {
|
|||
sm := string(mm)
|
||||
println(sm)
|
||||
//
|
||||
arr := []byte{}
|
||||
arr := []u8{}
|
||||
sa := string(arr)
|
||||
println(sa)
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@ const size = -1
|
|||
|
||||
fn main() {
|
||||
a := [size]int{}
|
||||
b := [0]byte{}
|
||||
b := [0]u8{}
|
||||
println(a)
|
||||
println(b)
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
fn uu8(a byte) {}
|
||||
fn uu8(a u8) {}
|
||||
|
||||
fn arr(a []int) {}
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
mut f := fn(i int) byte {}
|
||||
mut f := fn (i int) u8 {}
|
||||
f = 4
|
||||
mut p := &f
|
||||
p = &[f]
|
||||
_ = p
|
||||
i := 0
|
||||
println(i)
|
||||
f = fn(mut a []int) { println(i) }
|
||||
f = fn (mut a []int) {
|
||||
println(i)
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
type Int = byte | int
|
||||
type Int = int | u8
|
||||
|
||||
fn main() {
|
||||
i := Int(0)
|
||||
if mut i is int {
|
||||
i = 1
|
||||
} else if mut i is byte {
|
||||
} else if mut i is u8 {
|
||||
i = 2
|
||||
}
|
||||
println(i)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
s := ''
|
||||
s.len = 123
|
||||
//
|
||||
b := []byte{}
|
||||
b := []u8{}
|
||||
b.len = 34
|
||||
|
|
|
@ -11,7 +11,7 @@ fn (d Dog) speak() {}
|
|||
struct Cat {}
|
||||
|
||||
fn main() {
|
||||
if IoS(1) is byte {
|
||||
if IoS(1) is u8 {
|
||||
println('not cool')
|
||||
}
|
||||
a := Animal(Dog{})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
type Int = byte | int
|
||||
type Int = int | u8
|
||||
|
||||
fn main() {
|
||||
i := Int(0)
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
module main
|
||||
|
||||
struct Animal {
|
||||
mut:
|
||||
height byte
|
||||
mut:
|
||||
height u8
|
||||
}
|
||||
|
||||
fn new_animal(height byte) ?Animal {
|
||||
fn new_animal(height u8) ?Animal {
|
||||
if height < 10 {
|
||||
return error('Too small to be an animal!')
|
||||
}
|
||||
|
||||
return Animal{ height: height }
|
||||
return Animal{
|
||||
height: height
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mut dog := new_animal(9) or {
|
||||
none
|
||||
}
|
||||
mut dog := new_animal(9) or { none }
|
||||
|
||||
println(dog)
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
struct Foo{}
|
||||
struct Foo {}
|
||||
|
||||
fn main() {
|
||||
foo := Foo{}
|
||||
|
@ -14,4 +14,4 @@ fn main() {
|
|||
_ = &I1(foo)
|
||||
}
|
||||
|
||||
interface I1{}
|
||||
interface I1 {}
|
||||
|
|
|
@ -11,7 +11,7 @@ fn main() {
|
|||
]
|
||||
x := []int{len: 10, cap: 100, init: 1}
|
||||
_ := expected_flags
|
||||
buf := [100]byte{}
|
||||
buf := [100]u8{}
|
||||
println(x)
|
||||
println(buf)
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ pub:
|
|||
f u64
|
||||
pub mut:
|
||||
g string
|
||||
h byte
|
||||
h u8
|
||||
}
|
||||
|
||||
fn comptime_for() {
|
||||
|
|
|
@ -18,11 +18,11 @@ fn main() {
|
|||
// from another .v file
|
||||
|
||||
struct VerifyKey {
|
||||
public_key [public_key_size]byte
|
||||
public_key [public_key_size]u8
|
||||
}
|
||||
|
||||
struct SigningKey {
|
||||
secret_key [secret_key_size]byte
|
||||
secret_key [secret_key_size]u8
|
||||
pub:
|
||||
verify_key VerifyKey
|
||||
}
|
||||
|
|
|
@ -2,4 +2,4 @@ fn proc_pidpath(int, voidptr, int) int
|
|||
|
||||
fn C.realpath(&char, &char) &char
|
||||
|
||||
fn C.chmod(&byte, int) int
|
||||
fn C.chmod(&u8, int) int
|
||||
|
|
|
@ -1 +1 @@
|
|||
fn C.PQgetvalue(voidptr, int, int) &byte
|
||||
fn C.PQgetvalue(voidptr, int, int) &u8
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
pub interface ReaderWriter {
|
||||
read(mut buf []byte) ?int // from Reader
|
||||
write(buf []byte) ?int // from Writer
|
||||
read(mut buf []u8) ?int // from Reader
|
||||
write(buf []u8) ?int // from Writer
|
||||
}
|
||||
|
||||
interface Speaker {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pub fn str_escaped(b byte) string {
|
||||
pub fn str_escaped(b u8) string {
|
||||
str := match b {
|
||||
0 { '`\\' + '0`' } // Bug is preventing \\0 in a literal
|
||||
7 { '`\\a`' }
|
||||
|
|
|
@ -3,7 +3,7 @@ module abcde
|
|||
pub struct Builder {
|
||||
pub mut:
|
||||
// inline before field
|
||||
buf []byte
|
||||
buf []u8
|
||||
str_calls int
|
||||
len int
|
||||
initial_size int = 1
|
||||
|
@ -12,7 +12,7 @@ pub mut:
|
|||
pub fn new_builder(initial_size int) Builder {
|
||||
return Builder{
|
||||
// buf: make(0, initial_size)
|
||||
buf: []byte{cap: initial_size}
|
||||
buf: []u8{cap: initial_size}
|
||||
str_calls: 0 // after str_calls
|
||||
len: 0 // after len
|
||||
initial_size: initial_size // final
|
||||
|
|
|
@ -14,7 +14,7 @@ mut:
|
|||
store &Store = &Store(0)
|
||||
cursor TreeCursor
|
||||
module_name string
|
||||
src_text []byte
|
||||
src_text []u8
|
||||
// skips the local scopes and registers only
|
||||
// the top-level ones regardless of its
|
||||
// visibility
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
type FooBar = Bar | Foo
|
||||
pub type PublicBar = Bar | Foo | FooBar
|
||||
|
||||
type Uint = byte | u16 | u32 | u64 // This should stay on the same line
|
||||
type Uint = u16 | u32 | u64 | u8 // This should stay on the same line
|
||||
type Float = f32 | f64
|
||||
|
||||
// Alias type
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
union Un {
|
||||
i int
|
||||
b byte
|
||||
b u8
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
struct S1 {
|
||||
pub mut:
|
||||
v byte
|
||||
v u8
|
||||
module:
|
||||
i int
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ struct S2 {
|
|||
module:
|
||||
j int
|
||||
mut:
|
||||
v byte
|
||||
v u8
|
||||
}
|
||||
|
||||
mut s := S1{}
|
||||
|
|
|
@ -37,7 +37,7 @@ fn dump_of_callexpr() {
|
|||
vfile := @FILE
|
||||
dump(os.file_name(vfile))
|
||||
mut f := os.open_file(@FILE, 'r') or { return }
|
||||
mut buf := []byte{len: 10}
|
||||
mut buf := []u8{len: 10}
|
||||
dump(f.read(mut buf) or { -999 })
|
||||
f.close()
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
type Byte = byte
|
||||
type Byte = u8
|
||||
|
||||
fn (b Byte) str() string {
|
||||
return 'hello'
|
||||
|
|
Loading…
Reference in New Issue