From 4b176ba855d5845c2e433518a066b97cdb54336a Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 15 Oct 2019 04:26:19 +0300 Subject: [PATCH] string: test i64() and u64() --- vlib/builtin/string.v | 2 +- vlib/builtin/string_test.v | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 2e163219eb..19170a079b 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -206,7 +206,7 @@ pub fn (s string) u32() u32 { pub fn (s string) u64() u64 { $if tinyc { - return u64(s.int()) // TODO + return u64(s.i64()) // TODO } $else { return C.strtoull(*char(s.str), 0, 0) } diff --git a/vlib/builtin/string_test.v b/vlib/builtin/string_test.v index b2cea663f3..4145aba5cb 100644 --- a/vlib/builtin/string_test.v +++ b/vlib/builtin/string_test.v @@ -276,6 +276,7 @@ fn test_arr_contains() { fn test_to_num() { s := '7' assert s.int() == 7 + assert s.u64() == 7 f := '71.5 hasdf' assert f.f32() == 71.5 b := 1.52345 @@ -285,6 +286,9 @@ fn test_to_num() { a = '${num:03d}' vals := ['9'] assert vals[0].int() == 9 + big := '93993993939322' + assert big.u64() == 93993993939322 + assert big.i64() == 93993993939322 } fn test_hash() { @@ -477,3 +481,4 @@ fn test_escape() { //a := 10 //println("\"$a") } +