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

remove u8 and i32 from tests and examples

This commit is contained in:
Alexander Medvednikov
2019-09-02 15:02:25 +03:00
parent 0db1eaa55a
commit 1c6d51f271
12 changed files with 38 additions and 43 deletions

View File

@@ -81,20 +81,20 @@ pub fn (nn u32) str() string {
}
/*
pub fn (nn u8) str() string {
pub fn (nn byte) str() string {
mut n := nn
if n == u8(0) {
if n == byte(0) {
return '0'
}
max := 5
mut buf := malloc(max)
mut len := 0
// Fill the string from the end
for n > u8(0) {
d := n % u8(10)
buf[max - len - 1] = d + u8(`0`)
for n > byte(0) {
d := n % byte(10)
buf[max - len - 1] = d + byte(`0`)
len++
n = n / u8(10)
n = n / byte(10)
}
return tos(buf + max - len, len)
}

View File

@@ -20,8 +20,8 @@ fn test_str_methods() {
assert i64(1).str() == '1'
assert i64(-1).str() == '-1'
assert u8(1).str() == '1'
assert u8(-1).str() == '255'
assert byte(1).str() == '1'
assert byte(-1).str() == '255'
assert u16(1).str() == '1'
assert u16(-1).str() == '65535'
assert u32(1).str() == '1'

View File

@@ -417,4 +417,4 @@ fn test_for_loop_two() {
for i, c in s {
assert c == s[i]
}
}
}