Skip to content

Commit

Permalink
Complete tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno-Vdr committed Feb 18, 2025
1 parent 95e99ca commit 1d4f2f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions vlib/strconv/atoi.v
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,9 @@ fn atoi_common_check(s string) !(i64, int) {
return sign, start_idx
}

// atoi_common performs computation for all i8, i16 i32 and i64 types.
// Factorizes the code, and return consistent error message over differents types.
// atoi_common performs computation for all i8, i16 and i32 type, excluding i64.
// Parse values, and returns consistent error message over differents types.
// s is string to parse, type_min/max are respective types min/max values.
@[direct_array_access]
fn atoi_common(s string, type_min i64, type_max i64) !i64 {
mut sign, mut start_idx := atoi_common_check(s)!
Expand Down
2 changes: 1 addition & 1 deletion vlib/strconv/atoi_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ fn test_atoi64() {
'-9223372036854775809', // i64 bits underflow by 1.
'+9223372036854775808', // i64 bit overflow by 1.
'+18446744073709551615', // Large Overflow but equal to u64 max.
'-483647909912754123456789', // Large i32 underflow.
'-483647909912754123456789', // Large i64 underflow.
]

for v in ko {
Expand Down

0 comments on commit 1d4f2f2

Please sign in to comment.