From 1d4f2f2f70528cf8d8acab00e5a95b0ae75e8fbb Mon Sep 17 00:00:00 2001 From: Bruno Date: Tue, 18 Feb 2025 19:00:17 +0100 Subject: [PATCH] Complete tests. --- vlib/strconv/atoi.v | 5 +++-- vlib/strconv/atoi_test.v | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vlib/strconv/atoi.v b/vlib/strconv/atoi.v index 334a025af4caab..3b0d9503acbddc 100644 --- a/vlib/strconv/atoi.v +++ b/vlib/strconv/atoi.v @@ -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)! diff --git a/vlib/strconv/atoi_test.v b/vlib/strconv/atoi_test.v index 72e16ac8b78ec4..ced915429d73a6 100644 --- a/vlib/strconv/atoi_test.v +++ b/vlib/strconv/atoi_test.v @@ -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 {